Hello,

I have a question regarding the right design of 
an USB character driver:

at open(), the device descriptor is allocated from the heap.
Inside the descriptor is the mutex to protect against user space
race conditions. The pointer to the device descriptor is stored
in file->private_data.

at release(), the mutex is aquired. Then, the whole descriptor
is freed...

I have a problem with this design:

what happens if another process who has access to the file
descriptor does a read() or something similar? The process
will have to wait for release of the mutex, which will never
happens.

I have seen this sort of design in usb_skeleton.c and some
other drivers. Is there something in user or kernel space
which protects the driver against this race? Is this safe?
I have not found an explanation in "Linux device drivers".

best regards
Wolfgang

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to