On Wed, 2002-10-23 at 23:11, Joe Burks wrote:
> I'm fairly new to Linux kernel development.  What is the proper locking 
> mechanism to ensure that if two processes are potentially simultaneously 
> executing a disconnect and proc read that no accesses to freed memory 
> occurs?  As soon as the proc read function starts executing, its data field 
> may already refer to freed memory.  A semaphore in a per-device structure 
> that is freed during a disconnect would not work.
> 
> It might be possible if the data field refers to an entry of an array that 
> will survive a disconnect (lives as long as the module does), but I bet 
> that would still race if there was a simultaneous read and rmmod.  I think 
> it would also mean I'd have to limit the number of devices that could be 
> plugged in ahead of time.
> 
> What is the painful-but-correct method?

Anything that works. I think most people have found that refcounting is
the easiest path to achieve most of this. 

Alan (off to refcount the IDE drivers next)



-------------------------------------------------------
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?sunm0002en

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

Reply via email to