On Mon, 23 Jun 2003, Pete Zaitcev wrote:

>> If usb_disconnect() can happen while already executing in open(), and if
>> the former frees the data structures used by the driver, then the latter
>> call might continue working with already freed memory region which could
>> lead to catastrophe.
>
>This is why God has given you semaphores, spinlocks, and
>reference counts.

I guess I'm a newbie in kernel programming, but I can't think of any way to
fix it.

Let's suppose user calls open() on my device. The first line of open()
call could lock semaphores, increase reference counts, whatever, but all is
useless if usb_disconnect() happens _after_ open() system call but _before_
the first line of the open()-function has been executed.

So I can not think of any way to fix it... usb_disconnect() can not trust
that the open() call has had time to do any locking, or anything. How can
it know whether resources may be freed?

And wasn't it Linus not God... oh nevermind. I just remembered the
principle of equivalence ;)



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to