Module Name:    src
Committed By:   christos
Date:           Thu Dec 27 01:11:14 UTC 2012

Modified Files:
        src/sys/dev/usb: if_otus.c

Log Message:
prevent double free on error.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/usb/if_otus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_otus.c
diff -u src/sys/dev/usb/if_otus.c:1.14 src/sys/dev/usb/if_otus.c:1.15
--- src/sys/dev/usb/if_otus.c:1.14	Sat Dec  8 21:59:16 2012
+++ src/sys/dev/usb/if_otus.c	Wed Dec 26 20:11:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_otus.c,v 1.14 2012/12/09 02:59:16 christos Exp $	*/
+/*	$NetBSD: if_otus.c,v 1.15 2012/12/27 01:11:13 christos Exp $	*/
 /*	$OpenBSD: if_otus.c,v 1.18 2010/08/27 17:08:00 jsg Exp $	*/
 
 /*-
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.14 2012/12/09 02:59:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.15 2012/12/27 01:11:13 christos Exp $");
 /*-
  * Driver for Atheros AR9001U chipset.
  * http://www.atheros.com/pt/bulletins/AR9001USBBulletin.pdf
@@ -1876,7 +1876,6 @@ otus_tx(struct otus_softc *sc, struct mb
 	xferlen = sizeof(*head) + m->m_pkthdr.len;
 	m_copydata(m, 0, m->m_pkthdr.len, (void *)&head[1]);
 	m_freem(m);
-	ieee80211_free_node(ni);
 
 	DPRINTFN(5, "tx queued=%d len=%d mac=0x%04x phy=0x%08x rate=%d\n",
 	    sc->sc_tx_queued, head->len, head->macctl, head->phyctl,
@@ -1887,6 +1886,7 @@ otus_tx(struct otus_softc *sc, struct mb
 	if (__predict_false(error != USBD_IN_PROGRESS && error != 0))
 		return error;
 
+	ieee80211_free_node(ni);
 	sc->sc_tx_queued++;
 	sc->sc_tx_cur = (sc->sc_tx_cur + 1) % OTUS_TX_DATA_LIST_COUNT;
 

Reply via email to