summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakemsr <jakemsr@openbsd.org>2010-12-06 05:46:17 +0000
committerjakemsr <jakemsr@openbsd.org>2010-12-06 05:46:17 +0000
commit30211b63f77e070c3c72ddf0099a3958ec165950 (patch)
treed0d4890e7950f0e327262748175deec9036b9673
parent* replace per-driver dying and/or other state variables with use of (diff)
downloadwireguard-openbsd-30211b63f77e070c3c72ddf0099a3958ec165950.tar.xz
wireguard-openbsd-30211b63f77e070c3c72ddf0099a3958ec165950.zip
a couple unchecked if_detach() in detach routines that were missed
in previous sweep (avoid NULL deref if the device didn't fully attach)
-rw-r--r--sys/dev/usb/if_upl.c5
-rw-r--r--sys/dev/usb/ueagle.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c
index a3599941706..0c91e0773a1 100644
--- a/sys/dev/usb/if_upl.c
+++ b/sys/dev/usb/if_upl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_upl.c,v 1.44 2010/09/24 08:33:59 yuo Exp $ */
+/* $OpenBSD: if_upl.c,v 1.45 2010/12/06 05:46:17 jakemsr Exp $ */
/* $NetBSD: if_upl.c,v 1.19 2002/07/11 21:14:26 augustss Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -334,7 +334,8 @@ upl_detach(struct device *self, int flags)
if (ifp->if_flags & IFF_RUNNING)
upl_stop(sc);
- if_detach(ifp);
+ if (ifp->if_softc != NULL)
+ if_detach(ifp);
#ifdef DIAGNOSTIC
if (sc->sc_ep[UPL_ENDPT_TX] != NULL ||
diff --git a/sys/dev/usb/ueagle.c b/sys/dev/usb/ueagle.c
index 4416d07d9f5..a7749a131fa 100644
--- a/sys/dev/usb/ueagle.c
+++ b/sys/dev/usb/ueagle.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ueagle.c,v 1.30 2010/12/06 04:41:40 jakemsr Exp $ */
+/* $OpenBSD: ueagle.c,v 1.31 2010/12/06 05:46:17 jakemsr Exp $ */
/*-
* Copyright (c) 2003-2006
@@ -256,7 +256,8 @@ ueagle_detach(struct device *self, int flags)
sc->sc_dev.dv_xname));
}
- if_detach(ifp);
+ if (ifp->if_softc != NULL)
+ if_detach(ifp);
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
&sc->sc_dev);