Re: [Linux-uvc-devel] [BUG] NULL pointer dereference caused by uvcvideo stress test

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Laurent Pinchart
Date: Wednesday, October 15, 2008 - 11:17 am

Hi Alan,

On Wednesday 15 October 2008, Alan Jenkins wrote:

I had secretly hoped it would have disapearred :-)


The NULL pointer (or rather 0x00000030 pointer) dereference happens in 
video_open:

        file->f_op = fops_get(vfl->fops);
        if (file->f_op->open)
                err = file->f_op->open(inode, file);

file->f_op ends up being NULL. Either vfl->fops is NULL to begin with, or 
fops_get failed to get a reference to the file_operations structure.

I'd be surprised if vfl->fops was NULL. To rule out that case, can you add a 
BUG_ON(vfl->fops == NULL) before the call to fops_get ?

I'm not too familiar with the module loader, but a quick look at the code 
shows that the module could be marked as being unloaded (MODULE_STATE_GOING) 
before its exit function is called. If this is the case video_open would 
still be called, as the video device would still be registered, but fops_get 
would fail in try_module_get and return a NULL pointer. It seems the pointer 
returned by fops_get should be tested in video_open.

I've CC'ed the v4l maintainer to get his opinion on this.


Best regards,

Laurent Pinchart
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [Linux-uvc-devel] [BUG] NULL pointer dereference cause ..., Laurent Pinchart, (Wed Oct 15, 11:17 am)
Re: [Linux-uvc-devel] [BUG] NULL pointer dereference cause ..., Mauro Carvalho Chehab, (Fri Oct 24, 7:31 am)