cvs commit: src/sys/dev/ed if_ed.c if_ed_pccard.c if_edvar.h

Ruslan Ermilov ru at
Sun Sep 18 22:40:40 PDT 2005

On Sun, Sep 18, 2005 at 08:51:34PM +0000, Warner Losh wrote:
>   o Fix one bug that's common to many drivers.  call if_free(ifp) after
>     we tear down the interrupt.  ed_intr() depends on ifp being there and
>     freeing it while interrupts can still happen is, ummm, bad.
I think this change is a mismerge from some of your work with my work
already in CVS.  if_free(ifp) is already called in ed_release_resources(),
which is used both in the failure case in ed_*_attach() and in ed_detach().
What's now in CVS should cause freeing a NULL pointer on detach.

About the commonality...  Usually foo_stop() (which is called first in
foo_detach() if you were talking about the detach) disables interrupts,
so foo_intr() doesn't usually happen.  From reading the code, I see the
same holds true for ed(4).

OTOH, it was shown that on some SMP machines it's possible to get a
call to foo_intr() after foo_stop() has been called by foo_shutdown(),
which will lead to a panic in most of the drivers.  See kern/85005 and
kern/62889 for some examples.

I think the generic solution to this problem should be to return from
foo_intr() quickly if IFF_DRV_RUNNING is not set.

Ruslan Ermilov
ru at
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the cvs-src mailing list