Date: Thu, 18 Feb 2010 15:59:05 -0500 From: "J.R. Oldroyd" <fbsd@opal.com> To: Lars Engels <lme@FreeBSD.org> Cc: emulation@FreeBSD.org, Hans Petter Selasky <hselasky@c2i.net>, freebsd-multimedia@FreeBSD.org, multimedia@FreeBSD.org, lme@FreeBSD.org, Leidinger <Alexander@leidinger.net>, Alexander Subject: Re: FYI: v4l-linuxulator support in FreeBSD-current now [panic] 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>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <lme@FreeBSD.org> 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.+--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100218155905.4aaa57bb>