DragonFly BSD
DragonFly submit List (threaded) for 2010-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[PATCH] ucom - destroy device node on detach


From: YONETANI Tomokazu <qhwt.dfly@xxxxxxxxxx>
Date: Thu, 7 Oct 2010 11:27:16 +0900

Issuing `ls /dev' after unloading the driver triggered a panic because
of the stale device node.
---
 sys/dev/usbmisc/ucom/ucom.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/sys/dev/usbmisc/ucom/ucom.c b/sys/dev/usbmisc/ucom/ucom.c
index f85c3b7..a0a7260 100644
--- a/sys/dev/usbmisc/ucom/ucom.c
+++ b/sys/dev/usbmisc/ucom/ucom.c
@@ -177,7 +177,7 @@ ucom_attach(struct ucom_softc *sc)
 
 	DPRINTF(("ucom_attach: make_dev: ucom%d\n", unit));
 
-	dev = make_dev(&ucom_ops, unit | UCOM_CALLOUT_MASK,
+	sc->dev = dev = make_dev(&ucom_ops, unit | UCOM_CALLOUT_MASK,
 			UID_UUCP, GID_DIALER, 0660,
 			"ucom%d", unit);
 	dev->si_tty = tp;
@@ -194,6 +194,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;
 
-- 
1.7.0.5




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]