All of lore.kernel.org
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: xiaosuo <xiaosuo@gmail.com>, Tom Herbert <therbert@google.com>,
	netdev@vger.kernel.org
Subject: [PATCH] rps: memory leak due to forget to release rx queues
Date: Tue, 23 Mar 2010 14:05:39 +0800	[thread overview]
Message-ID: <4BA85A33.6050004@gmail.com> (raw)

memory leak due to forget to release rx queues.

rx queues is allocated in alloc_netdev_mq(), but they aren't released in
free_netdev(), and the field rps_map is also miss.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
net/core/dev.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index c0e2608..51b86e0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5746,6 +5746,14 @@ void free_netdev(struct net_device *dev)
 
 	release_net(dev_net(dev));
 
+	if (dev->num_rx_queues) {
+		int i;
+
+		for (i = 0; i < dev->num_rx_queues; i++)
+			kfree(dev->_rx[i].rps_map);
+		kfree(dev->_rx);
+	}
+
 	kfree(dev->_tx);
 
 	/* Flush device addresses */



             reply	other threads:[~2010-03-23  6:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23  6:05 Changli Gao [this message]
2010-03-23  6:44 ` [PATCH] rps: memory leak due to forget to release rx queues Tom Herbert
2010-03-23  7:02   ` Changli Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BA85A33.6050004@gmail.com \
    --to=xiaosuo@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.