>>  In the original code of video_open() there are two small bugs:
>>  (1) the counter of the module is not incremented _before_ the
>>      file->f_op->open(inode,file) function call, but only before
>>      the vfl->open() one.

>This isn't a bug.  fops_get+put handles the module reference counting.

Oops, you are right. I completely forgot it..:-)

>> (2) the increment of the variable vfl->users is incoherent with the
>>     decrement of the same variable in the function video_release().
>>     A brief analysis of the source code and of the patch reveals 
>>     that it is so, but i will not enter into details.

> Please go into details, IMHO the current code is fine.

The fact is that I am writing a driver for my webcam.
So I thought to use the field "users" of the struct video_device* 
to keep track of the number of users that are accessing to the 
V4L device at a time. 
For some reasons some problems occurred with that counter after a 
series of open and release calls (using the new interface), 
so i tried to search for some bugs in videodev.c 
(if they eventually existed).

I found that in the function video_open() a vfl->users++ instruction
is never reached, in case of success of the 
file->f_op->open(inode,file) call.
On the contrary, vfl->users is always decremented in video_release() 
using both the new and the old interface.
Therefore vfl->users can assume negative values...

However I may be wrong..

Thank you, Luca Risolia.






--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@;redhat.com?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/video4linux-list

Reply via email to