ucom - destroy device node on detach
authorYONETANI Tomokazu <y0netan1@dragonflybsd.org>
Tue, 12 Oct 2010 12:32:14 +0000 (21:32 +0900)
committerYONETANI Tomokazu <y0netan1@dragonflybsd.org>
Tue, 12 Oct 2010 12:32:14 +0000 (21:32 +0900)
Issuing `ls /dev' after unloading the driver triggered a panic because
of the stale device node.

sys/dev/usbmisc/ucom/ucom.c

index f85c3b7..66ccc53 100644 (file)
@@ -181,6 +181,7 @@ ucom_attach(struct ucom_softc *sc)
                        UID_UUCP, GID_DIALER, 0660,
                        "ucom%d", unit);
        dev->si_tty = tp;
+       sc->dev = dev;
        lwkt_reltoken(&tty_token);
 
        return (0);
@@ -194,6 +195,7 @@ ucom_detach(struct ucom_softc *sc)
 
        DPRINTF(("ucom_detach: sc = %p, tp = %p\n", sc, sc->sc_tty));
 
+       destroy_dev(sc->dev);
        lwkt_gettoken(&tty_token);
        sc->sc_dying = 1;