Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Apr 2011 12:17:23 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-hackers@freebsd.org
Cc:        Bartosz Fabianowski <freebsd@chillt.de>
Subject:   Re: Is there some implicit locking of device methods?
Message-ID:  <201104261217.23858.hselasky@c2i.net>
In-Reply-To: <4DB695DB.1080505@chillt.de>
References:  <4DB695DB.1080505@chillt.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104261217.23858.hselasky>