summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/net/uhso.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2014-07-01 07:13:41 +0000
committerhselasky <hselasky@FreeBSD.org>2014-07-01 07:13:41 +0000
commitc07ae1789a4d3c79a2a95545833b8efc631a3e97 (patch)
tree9b391eec94fc5600efd652b69af4388afc873921 /sys/dev/usb/net/uhso.c
parentf95fd16f8d88667bcf37bb162d3f8fcc9f888cc7 (diff)
downloadFreeBSD-src-c07ae1789a4d3c79a2a95545833b8efc631a3e97.zip
FreeBSD-src-c07ae1789a4d3c79a2a95545833b8efc631a3e97.tar.gz
Fix for use after free.
MFC after: 3 days
Diffstat (limited to 'sys/dev/usb/net/uhso.c')
-rw-r--r--sys/dev/usb/net/uhso.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/dev/usb/net/uhso.c b/sys/dev/usb/net/uhso.c
index ec84b0f..ba6236c 100644
--- a/sys/dev/usb/net/uhso.c
+++ b/sys/dev/usb/net/uhso.c
@@ -559,8 +559,6 @@ uhso_attach(device_t self)
mtx_init(&sc->sc_mtx, "uhso", NULL, MTX_DEF);
ucom_ref(&sc->sc_super_ucom);
- sc->sc_ucom = NULL;
- sc->sc_ttys = 0;
sc->sc_radio = 1;
id = usbd_get_interface_descriptor(uaa->iface);
@@ -680,9 +678,6 @@ uhso_detach(device_t self)
UHSO_CTRL_MAX);
}
}
-
- free(sc->sc_tty, M_USBDEV);
- free(sc->sc_ucom, M_USBDEV);
}
if (sc->sc_ifp != NULL) {
@@ -710,6 +705,8 @@ static void
uhso_free_softc(struct uhso_softc *sc)
{
if (ucom_unref(&sc->sc_super_ucom)) {
+ free(sc->sc_tty, M_USBDEV);
+ free(sc->sc_ucom, M_USBDEV);
mtx_destroy(&sc->sc_mtx);
device_free_softc(sc);
}
OpenPOWER on IntegriCloud