diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2010-12-06 05:46:18 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2010-12-06 05:46:18 +0000 |
commit | 0f3d7aac0fc7c6c0d127e1361ae08cff2653ea2d (patch) | |
tree | 39aa5009911039e5f2b1b83beb9982e187decb3c /sys | |
parent | 586226f2be8916cb9799bd7c4c47749b6f386d52 (diff) |
a couple unchecked if_detach() in detach routines that were missed
in previous sweep (avoid NULL deref if the device didn't fully attach)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/if_upl.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/ueagle.c | 5 |
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); |