Is there some implicit locking of device methods?
Hans Petter Selasky
hselasky at c2i.net
Tue Apr 26 10:18:30 UTC 2011
On Tuesday 26 April 2011 11:52:27 Bartosz Fabianowski wrote:
> 1. attach() is running and executes make_dev(). Before attach() has
> finished, someone calls open() on the newly created device node and
> tries to read from a device that is not fully instantiated.
>
> 2. read() is running when the device is suddenly pulled (this is a USB
> device) so that detach() gets run. Thus, detach() starts tearing down
> data structures that read() may still be accessing.
Hi,
You need to handle all cases in your driver. Fortunately there exists a
solution for this already, called USB cdev. See
serial/ulpt.c
for example.
--HPS
More information about the freebsd-hackers
mailing list