From owner-freebsd-multimedia@FreeBSD.ORG Thu Feb 18 17:08:20 2010 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0B8C106566C; Thu, 18 Feb 2010 17:08:20 +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 17F858FC17; Thu, 18 Feb 2010 17:08:19 +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 12:08:17 -0500 X-REPUTATION: None X-REMOTE-IP: 66.171.78.153 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEANgBfUtCq06Z/2dsb2JhbACbB3S9ToRnBIMVGg X-IronPort-AV: i="4.49,498,1262581200"; d="asc'?scan'208"; a="214960883:sNHT36914580" Received: from opal.com (localhost [IPv6:::1]) (authenticated bits=0) by homobox.opal.com (8.14.3/8.14.3) with ESMTP id o1IH8GOj023974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 18 Feb 2010 12:08:16 -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 12:08:16 -0500 Date: Thu, 18 Feb 2010 12:08:12 -0500 From: "J.R. Oldroyd" To: Hans Petter Selasky Message-ID: <20100218120812.2224f6bf@shibato.opal.com> In-Reply-To: <201002172137.25396.hselasky@c2i.net> References: <20091204223126.00005392@unknown> <20100112124621.59fa3747@shibato.opal.com> <201001121849.48833.hselasky@c2i.net> <201002172137.25396.hselasky@c2i.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_/q6wfV9dmVu6L0DVac4rl6oH"; protocol="application/pgp-signature" Cc: freebsd-multimedia@freebsd.org, lme@freebsd.org, emulation@freebsd.org, multimedia@freebsd.org, Alexander Leidinger 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 17:08:20 -0000 --Sig_/q6wfV9dmVu6L0DVac4rl6oH Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 17 Feb 2010 21:37:25 +0100, Hans Petter Selasky = wrote: > > On Tuesday 12 January 2010 18:49:48 Hans Petter Selasky wrote: > > Re: FYI: v4l-linuxulator support in FreeBSD-current now > >=20 >=20 > Hi, >=20 > Some panics have cropped up when using linux-V4L with webcamd. >=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 > I tried to fix something, but it was not enough. >=20 > Help appreciated. >=20 > We are currently debugging this issue @ #bsdusb on efnet. >=20 > --HPS >=20 > --- linux_ioctl.c.orig 2010-02-17 20:42:53.000000000 +0100 > +++ linux_ioctl.c 2010-02-17 21:03:10.000000000 +0100 > @@ -2711,7 +2711,7 @@ > /* XXX: If there can be no concurrency: s/M_NOWAIT/M_WAITOK/ */ > if ((*ppvc =3D malloc(sizeof(**ppvc), M_LINUX, M_NOWAIT)) =3D=3D = NULL) > return (ENOMEM); /* XXX: linux has no ENOMEM here */ > - memcpy(&vclip, *ppvc, sizeof(vclip)); > + memcpy(*ppvc, &vclip, sizeof(vclip)); > (*ppvc)->next =3D NULL; > return (0); > } > @@ -2719,13 +2719,15 @@ > static int > linux_v4l_cliplist_free(struct video_window *vw) > { > - struct video_clip **ppvc; > - struct video_clip **ppvc_next; > + struct video_clip *ppvc; > + struct video_clip *ppvc_next; > =20 > - for (ppvc =3D &(vw->clips); *ppvc !=3D NULL; ppvc =3D ppvc_next) { > - ppvc_next =3D &((*ppvc)->next); > - free(*ppvc, M_LINUX); > + for (ppvc =3D vw->clips; ppvc !=3D NULL; ppvc =3D ppvc_next) { > + ppvc_next =3D ppvc->next; > + free(ppvc, M_LINUX); > } > + vw->clips =3D NULL; > + > return (0); > } > =20 I wrote the video_clip support but was unable to test it due to lack of either a driver that supported it or an application that used it. I did this based on very sparse documentation on what a video clip list actually is. Looks like the memcpy in linux_v4l_clip_copy is indeed backwards, so sorry about that. Simplifying the double pointers in linux_v4l_cliplist_free is probably also OK, but in that case, you should also rename the pointers to "pvc" rather than "ppvc". If it is still failing with these changes, it would help to know if the failure is happening during the cliplist build, during the ioctl that uses the cliplist, or when tearing down the cliplist after the call. You could try instrumenting LINUX_VIDIOCSWIN to see how far it is getting. -jr --Sig_/q6wfV9dmVu6L0DVac4rl6oH Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkt9c/wACgkQls33urr0k4md+gCfThu0FwXq9Hw145yRlJDgDeLE VvkAn084uy/VFuKPLfCISdhiD0PfU6uY =hAoZ -----END PGP SIGNATURE----- --Sig_/q6wfV9dmVu6L0DVac4rl6oH--