Date: Tue, 1 Jul 2014 07:13:41 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268078 - head/sys/dev/usb/net Message-ID: <201407010713.s617Df7S005174@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Tue Jul 1 07:13:41 2014 New Revision: 268078 URL: http://svnweb.freebsd.org/changeset/base/268078 Log: Fix for use after free. MFC after: 3 days Modified: head/sys/dev/usb/net/uhso.c Modified: head/sys/dev/usb/net/uhso.c ============================================================================== --- head/sys/dev/usb/net/uhso.c Tue Jul 1 06:59:23 2014 (r268077) +++ head/sys/dev/usb/net/uhso.c Tue Jul 1 07:13:41 2014 (r268078) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407010713.s617Df7S005174>