atom feed39 messages in org.freebsd.freebsd-multimediaRe: FYI: v4l-linuxulator support in F...
FromSent OnAttachments
Alexander LeidingerDec 4, 2009 1:31 pm 
J.R. OldroydDec 5, 2009 11:09 am 
Matthias ApitzJan 8, 2010 7:38 am 
J.R. OldroydJan 8, 2010 7:40 am 
Hans Petter SelaskyJan 8, 2010 7:49 am 
Matthias ApitzJan 8, 2010 8:02 am 
J.R. OldroydJan 8, 2010 8:36 am 
J.R. OldroydJan 8, 2010 8:41 am 
eculpJan 8, 2010 5:18 pm 
Matthias ApitzJan 8, 2010 11:12 pm 
Matthias ApitzJan 9, 2010 1:07 am 
Matthias ApitzJan 11, 2010 11:06 pm 
Hans Petter SelaskyJan 12, 2010 12:23 am 
Alexander LeidingerJan 12, 2010 2:16 am 
J.R. OldroydJan 12, 2010 9:45 am 
Hans Petter SelaskyJan 12, 2010 9:49 am 
J.R. OldroydJan 12, 2010 10:17 am 
Hans Petter SelaskyFeb 17, 2010 12:37 pm 
J.R. OldroydFeb 18, 2010 9:07 am 
Lars EngelsFeb 18, 2010 10:23 am 
J.R. OldroydFeb 18, 2010 12:58 pm 
Matthias ApitzSep 6, 2010 1:34 am 
Matthias ApitzSep 6, 2010 4:51 am 
Alexander LeidingerSep 6, 2010 5:45 am 
Matthias ApitzSep 7, 2010 2:43 am 
Alexander LeidingerSep 7, 2010 2:55 am 
Hans Petter SelaskyJan 11, 2011 12:47 am 
Alexander LeidingerJan 11, 2011 4:11 am 
Hans Petter SelaskyJan 11, 2011 4:18 am 
Alexander LeidingerJan 11, 2011 4:36 am 
J.R. OldroydJan 11, 2011 6:25 am 
Andrew GallatinJan 11, 2011 7:17 am 
Alexander LeidingerJan 11, 2011 7:40 am 
Juergen LockJan 11, 2011 10:39 am 
Andrew GallatinJan 11, 2011 12:17 pm 
J.R. OldroydJan 11, 2011 1:08 pm 
Juergen LockJan 11, 2011 2:20 pm 
Alexander LeidingerJan 12, 2011 2:08 am 
Andrew GallatinJan 12, 2011 5:35 am 
Subject:Re: FYI: v4l-linuxulator support in FreeBSD-current now [panic]
From:J.R. Oldroyd (fb@opal.com)
Date:Feb 18, 2010 12:58:42 pm
List:org.freebsd.freebsd-multimedia

On Thu, 18 Feb 2010 19:23:36 +0100, Lars Engels <lm@FreeBSD.org> wrote:

1st) panic: freeing memory in linux_v4l_cliplist_free() which is not allocated, but there seems to be more which needs to be done.

Hi jr,

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 <= 16384, a value Alexander found in one of the Linux drivers that does support cliplists. But if clipcount is > 0 && <= 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