From owner-freebsd-multimedia@FreeBSD.ORG Thu Feb 18 20:59:14 2010 Return-Path: Delivered-To: multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A29FB1065670; Thu, 18 Feb 2010 20:59:14 +0000 (UTC) (envelope-from fbsd@opal.com) Received: from smtp.vzavenue.net (smtp.vzavenue.net [66.171.59.140]) by mx1.freebsd.org (Postfix) with ESMTP id 131D18FC1D; Thu, 18 Feb 2010 20:59:12 +0000 (UTC) Received: from 153.78.171.66.subscriber.vzavenue.net (HELO homobox.opal.com) ([66.171.78.153]) by smtp.vzavenue.net with ESMTP; 18 Feb 2010 15:59:09 -0500 X-REPUTATION: None X-REMOTE-IP: 66.171.78.153 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAP8rfUtCq06Z/2dsb2JhbACbCHS9HYRnBIMV X-IronPort-AV: i="4.49,498,1262581200"; d="asc'?scan'208"; a="214969583:sNHT22695174" Received: from opal.com (localhost [IPv6:::1]) (authenticated bits=0) by homobox.opal.com (8.14.3/8.14.3) with ESMTP id o1IKx94h030061 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 18 Feb 2010 15:59:09 -0500 (EST) (envelope-from fbsd@opal.com) Received: from shibato.opal.com ([2001:5c0:1100:f103:221:63ff:fe5a:c9a7] helo=shibato.opal.com) with IPv6:587 by opal.com; 18 Feb 2010 15:59:09 -0500 Date: Thu, 18 Feb 2010 15:59:05 -0500 From: "J.R. Oldroyd" To: Lars Engels Message-ID: <20100218155905.4aaa57bb@shibato.opal.com> In-Reply-To: <20100218182336.GJ27126@e.0x20.net> References: <20091204223126.00005392@unknown> <20100112124621.59fa3747@shibato.opal.com> <201001121849.48833.hselasky@c2i.net> <201002172137.25396.hselasky@c2i.net> <20100218120812.2224f6bf@shibato.opal.com> <20100218182336.GJ27126@e.0x20.net> X-Mailer: Claws Mail 3.7.3 (GTK+ 2.16.6; amd64-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/3vDh+5+WP8WOtWbY1XpqQ.+"; protocol="application/pgp-signature" Cc: emulation@FreeBSD.org, freebsd-multimedia@FreeBSD.org, multimedia@FreeBSD.org, lme@FreeBSD.org, Leidinger , Alexander Subject: Re: FYI: v4l-linuxulator support in FreeBSD-current now [panic] X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2010 20:59:14 -0000 --Sig_/3vDh+5+WP8WOtWbY1XpqQ.+ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 18 Feb 2010 19:23:36 +0100, Lars Engels wrote: > > > >=20 > > > 1st) panic: freeing memory in linux_v4l_cliplist_free() which is not= =20 > > > allocated, but there seems to be more which needs to be done. > >=20 >=20 > Hi jr, >=20 > would you like to join us at #bsdusb at EFNet? Sorry, not set up for IRC here. Not sure how much help I would be. Never used video clip lists myself. The only reason that code is there is to try to offer more-or-less complete functionality rather than partial code. The intent of this code is to copy the cliplist in, creating new structures as it goes. This is necessary because the Linux list nodes contain Linux pointers to the next node and the pointers cannot be assumed to be the same size as FreeBSD pointers, especially on 64-bit archs. So the code walks the list creating a new list, then does the ioctl using that new list, then frees the new list again. What I do recall is that some Linux applications apparently do not use the cliplist but they also do not initialize the clips pointer to NULL nor do they initialize clipcount. They just assume the driver will ignore them, so don't bother setting them. Could the failure you're experiencing be due to the fact that the FreeBSD linuxulator code is trying to copy a list which is, in fact, not a valid list? I tried to avoid that, by only copying the list if clipcount <=3D 16384, a value Alexander found in one of the Linux drivers that does support cliplists. But if clipcount is > 0 && <=3D 16384, the clips pointer is followed, and this will fail if the application has not initialized it. The fix for this would be to either fix the Linux application code to initialize the list properly, or to add some form of pointer validation in the linuxulator code. Oh, and I remembered why I used the double pointer in cliplist_free, too. The cliplist_copy code uses a double pointer when creating the list because the head pointer needs to be changed. For code symmetry I therefore used the same double pointer when freeing the list. -jr --Sig_/3vDh+5+WP8WOtWbY1XpqQ.+ Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkt9qhkACgkQls33urr0k4npdwCgjHY32FMDjl6Fpbfu5guoZRKy ARkAoIdbOMD/0JWvRxUigDR/rxi7aU+7 =5RKd -----END PGP SIGNATURE----- --Sig_/3vDh+5+WP8WOtWbY1XpqQ.+--