FYI: v4l-linuxulator support in FreeBSD-current now [panic]

Lars Engels lme at FreeBSD.org
Thu Feb 18 18:43:00 UTC 2010


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 at c2i.net> wrote:
> >
> > On Tuesday 12 January 2010 18:49:48 Hans Petter Selasky wrote:
> > > Re: FYI: v4l-linuxulator support in FreeBSD-current now
> > > 
> > 
> > Hi,
> > 
> > Some panics have cropped up when using linux-V4L with webcamd.
> > 
> > 1st) panic: freeing memory in linux_v4l_cliplist_free() which is not 
> > allocated, but there seems to be more which needs to be done.
> > 
> > I tried to fix something, but it was not enough.
> > 
> > Help appreciated.
> > 
> > We are currently debugging this issue @ #bsdusb on efnet.
> > 
> > --HPS
> > 
> > --- 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 = malloc(sizeof(**ppvc), M_LINUX, M_NOWAIT)) == NULL)
> >                 return (ENOMEM);    /* XXX: linux has no ENOMEM here */
> > -       memcpy(&vclip, *ppvc, sizeof(vclip));
> > +       memcpy(*ppvc, &vclip, sizeof(vclip));
> >         (*ppvc)->next = 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;
> >  
> > -       for (ppvc = &(vw->clips); *ppvc != NULL; ppvc = ppvc_next) {
> > -               ppvc_next = &((*ppvc)->next);
> > -               free(*ppvc, M_LINUX);
> > +       for (ppvc = vw->clips; ppvc != NULL; ppvc = ppvc_next) {
> > +               ppvc_next = ppvc->next;
> > +               free(ppvc, M_LINUX);
> >         }
> > +       vw->clips = NULL;
> > +
> >         return (0);
> >  }
> >  
> 
> 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.
> 

Hi jr,

would you like to join us at #bsdusb at EFNet?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-multimedia/attachments/20100218/252ae2e0/attachment-0001.pgp


More information about the freebsd-multimedia mailing list