Am Freitag, 25. Oktober 2002 09:42 schrieb Joe Burks:
> At 01:04 AM 10/25/2002 +0200, Oliver Neukum wrote:
> >So this is safe if, and only if, remove_proc_entry waits
> >for current readers to finish before it returns.
> >As far as I can tell, this is not the case.
> >
> >So reading from the proc file while the camera is disconnected is
> >potentially deadly. I see no easy fix.
> >Comments?
> >
> >         Regards
> >                 Oliver
> >
> :(  I was hoping to ask on the list tonight if anybody had an idea how to
>
> do that.
>
> If I read that correctly, any USB driver creating a proc entry will have a
> disconnect race, right?  (I'm betting that will be true for any hot
> pluggable device with a proc entry) Can a proc_fs patch to do the wait make
> it in or is it too late for 2.6/3.0?
>
> Does driverfs have the same problem?  You'd mentioned some problems with it
> earlier.

Don't despair. That I can't see an easy fix doesn't mean that I don't see a fix,
it just easn't easy nor painless nor entirely clean.

First you need to understand that the V4L open has mutial exclusion with video
device unregistering. That means after unregistering your video device you
know it's either open or not and your disconnect can act on that knowledge.
With proc there's no open, therefore from a perspective of locking reading
is opening. Additionally you are passed a pointer that may be invalidated
by disconnect.

So in your read the easiest fix would be not to let proc pass you a pointer
to a device descriptor, but an offset into a table of pointers to device
descriptors which you can protect with a spinlock.
Probe and disconnect would have to update the table.

OK, this sucks. But if you are insisting on using proc, you pay the price.

        Regards
                Oliver



-------------------------------------------------------
This sf.net email is sponsored by: Influence the future
of Java(TM) technology. Join the Java Community
Process(SM) (JCP(SM)) program now.
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to