summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authordrochner <drochner@NetBSD.org>2007-07-11 20:13:14 +0000
committerdrochner <drochner@NetBSD.org>2007-07-11 20:13:14 +0000
commite2da0057b3ed9215d8acb2b132aab97bcd3fc66e (patch)
treecae64f20e431029a4794f6762d21996b9a1c1546 /sys/dev
parente8108f3e5b9f21dca410c4c07c54ba79f93cd1a9 (diff)
Stopgap fix to avoid crash on detach if the attach failed due to eg
USB problems - just return in detach if the softc appears not to be filled in completely. (This is a common problem with usb and probably other drivers which support detach; we need some API support to deal with this cleanly.)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/if_rum.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c
index 76f52a78f40..8aa0f9b3de7 100644
--- a/sys/dev/usb/if_rum.c
+++ b/sys/dev/usb/if_rum.c
@@ -1,5 +1,5 @@
/* $OpenBSD: if_rum.c,v 1.40 2006/09/18 16:20:20 damien Exp $ */
-/* $NetBSD: if_rum.c,v 1.12 2007/06/09 12:13:12 kiyohara Exp $ */
+/* $NetBSD: if_rum.c,v 1.13 2007/07/11 20:13:14 drochner Exp $ */
/*-
* Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini@free.fr>
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.12 2007/06/09 12:13:12 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.13 2007/07/11 20:13:14 drochner Exp $");
#include "bpfilter.h"
@@ -477,6 +477,9 @@ USB_DETACH(rum)
struct ifnet *ifp = &sc->sc_if;
int s;
+ if (!ifp->if_softc)
+ return 0;
+
s = splusb();
rum_stop(ifp, 1);