Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Feb 2010 19:23:36 +0100
From:      Lars Engels <lme@FreeBSD.org>
To:        "J.R. Oldroyd" <fbsd@opal.com>
Cc:        emulation@freebsd.org, freebsd-multimedia@freebsd.org, multimedia@freebsd.org, lme@freebsd.org, Alexander Leidinger <Alexander@leidinger.net>
Subject:   Re: FYI: v4l-linuxulator support in FreeBSD-current now [panic]
Message-ID:  <20100218182336.GJ27126@e.0x20.net>
In-Reply-To: <20100218120812.2224f6bf@shibato.opal.com>
References:  <20091204223126.00005392@unknown> <20100112124621.59fa3747@shibato.opal.com> <201001121849.48833.hselasky@c2i.net> <201002172137.25396.hselasky@c2i.net> <20100218120812.2224f6bf@shibato.opal.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--GEl8M6OaEs83Y7Jz
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Feb 18, 2010 at 12:08:12PM -0500, J.R. Oldroyd wrote:
> On Wed, 17 Feb 2010 21:37:25 +0100, Hans Petter Selasky <hselasky@c2i.net=
> 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
>=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.
>=20
> Looks like the memcpy in linux_v4l_clip_copy is indeed backwards,
> so sorry about that.
>=20
> 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".
>=20
> 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.
>=20

Hi jr,

would you like to join us at #bsdusb at EFNet?

--GEl8M6OaEs83Y7Jz
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkt9hagACgkQKc512sD3afj61wCdEK1olE82TXzul66DQV0frDcK
VZQAniLsMfoc8CkNa5yqwA8UAYN7ecrI
=aPfL
-----END PGP SIGNATURE-----

--GEl8M6OaEs83Y7Jz--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100218182336.GJ27126>