Module Name:    src
Committed By:   knakahara
Date:           Thu Jan 26 10:14:52 UTC 2017

Modified Files:
        src/sys/dev/pci: if_wm.c

Log Message:
fix memory leak at wm_detach.

pointed out and reviewed by [email protected].


To generate a diff of this commit:
cvs rdiff -u -r1.468 -r1.469 src/sys/dev/pci/if_wm.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/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.468 src/sys/dev/pci/if_wm.c:1.469
--- src/sys/dev/pci/if_wm.c:1.468	Mon Jan 16 09:58:04 2017
+++ src/sys/dev/pci/if_wm.c	Thu Jan 26 10:14:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.468 2017/01/16 09:58:04 maya Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.469 2017/01/26 10:14:52 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.468 2017/01/16 09:58:04 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.469 2017/01/26 10:14:52 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -5918,6 +5918,13 @@ wm_free_txrx_queues(struct wm_softc *sc)
 
 	for (i = 0; i < sc->sc_nqueues; i++) {
 		struct wm_txqueue *txq = &sc->sc_queue[i].wmq_txq;
+		struct mbuf *m;
+
+		/* drain txq_interq */
+		while ((m = pcq_get(txq->txq_interq)) != NULL)
+			m_freem(m);
+		pcq_destroy(txq->txq_interq);
+
 		wm_free_tx_buffer(sc, txq);
 		wm_free_tx_descs(sc, txq);
 		if (txq->txq_lock)

Reply via email to