Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci fix memory leak at wm_detach.



details:   https://anonhg.NetBSD.org/src/rev/4f1e93bf9238
branches:  trunk
changeset: 821158:4f1e93bf9238
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Thu Jan 26 10:14:52 2017 +0000

description:
fix memory leak at wm_detach.

pointed out and reviewed by msaitoh@n.o.

diffstat:

 sys/dev/pci/if_wm.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r d228a3d84755 -r 4f1e93bf9238 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu Jan 26 08:09:27 2017 +0000
+++ b/sys/dev/pci/if_wm.c       Thu Jan 26 10:14:52 2017 +0000
@@ -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 @@
 
        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)



Home | Main Index | Thread Index | Old Index