summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2013-11-21 14:08:05 +0000
committermpi <mpi@openbsd.org>2013-11-21 14:08:05 +0000
commitb896039b5391eb357b5ee3de1784b66545d5aeed (patch)
treed0c60f79c60bfc39d2fb8a04226e96313c57ebb0
parentsecurity update to nginx 1.4.4 which fixes CVE-2013-4547 (diff)
downloadwireguard-openbsd-b896039b5391eb357b5ee3de1784b66545d5aeed.tar.xz
wireguard-openbsd-b896039b5391eb357b5ee3de1784b66545d5aeed.zip
Revert r1.41, in this driver sc_attached does not indicate that the
driver is not yet attached, it is here to prevent the driver to free unitialized structures in case something wrong happened during the the initialization... Found the hard way and ok giovanni@
-rw-r--r--sys/dev/usb/if_urndis.c7
-rw-r--r--sys/dev/usb/if_urndisreg.h3
2 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c
index 6c8fc23e6e6..b3e190930a4 100644
--- a/sys/dev/usb/if_urndis.c
+++ b/sys/dev/usb/if_urndis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_urndis.c,v 1.43 2013/11/15 10:17:39 pirofti Exp $ */
+/* $OpenBSD: if_urndis.c,v 1.44 2013/11/21 14:08:05 mpi Exp $ */
/*
* Copyright (c) 2010 Jonathan Armani <armani@openbsd.org>
@@ -1487,6 +1487,7 @@ urndis_attach(struct device *parent, struct device *self, void *aux)
if_attach(ifp);
ether_ifattach(ifp);
+ sc->sc_attached = 1;
splx(s);
}
@@ -1502,6 +1503,9 @@ urndis_detach(struct device *self, int flags)
DPRINTF(("urndis_detach: %s flags %u\n", DEVNAME(sc),
flags));
+
+ if (!sc->sc_attached)
+ return 0;
s = splusb();
@@ -1513,6 +1517,7 @@ urndis_detach(struct device *self, int flags)
}
urndis_stop(sc);
+ sc->sc_attached = 0;
splx(s);
diff --git a/sys/dev/usb/if_urndisreg.h b/sys/dev/usb/if_urndisreg.h
index a801872bc55..54cc658f5e3 100644
--- a/sys/dev/usb/if_urndisreg.h
+++ b/sys/dev/usb/if_urndisreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_urndisreg.h,v 1.18 2013/11/08 10:12:20 pirofti Exp $ */
+/* $OpenBSD: if_urndisreg.h,v 1.19 2013/11/21 14:08:05 mpi Exp $ */
/*
* Copyright (c) 2010 Jonathan Armani <armani@openbsd.org>
@@ -41,6 +41,7 @@ struct urndis_cdata {
struct urndis_softc {
struct device sc_dev;
+ char sc_attached;
struct arpcom sc_arpcom;
/* RNDIS device info */