hotplug remove vs. device driver close

Greg KH greg at kroah.com
Fri Jun 4 06:39:37 EST 2004


On Thu, Jun 03, 2004 at 01:02:27PM -0700, Don Fry wrote:
> > >
> > > The pcnet32 driver tries to do the 'right thing' when it reads 0xffff,
> > > but that does not include doing a 'close' prior to being removed.  The
> > > driver could keep some state around so that if its remove routine was
> > > called without close first, it would cleanup, but I don't know of any
> > > network driver that does this.
> >
> > What I get out of this thread is that pcnet32, and in fact, all drivers,
> > should keep sufficient state around so that close() can be called either
> > after or before remove().
> >
>
> Today in 2.6.6 if I try and do a rmmod pcnet32 and something is still using
> the device, the rmmod will wait until the device is closed, and then it
> goes away.

Yes, that's a "feature" of the network stack :)

> If the unplug does the same thing, and doesn't complete until the
> close occurs, then I would not expect to leak anything, or crash
> either.

The device unplug knows nothing about the upper layers that the device
might have attached to, sorry.

thanks,

greg k-h

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list