[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65634d661003222344s662000e8ode1b4f49ff73b345@mail.gmail.com>
Date: Mon, 22 Mar 2010 23:44:08 -0700
From: Tom Herbert <therbert@...gle.com>
To: xiaosuo@...il.com
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH] rps: memory leak due to forget to release rx queues
2010/3/22 Changli Gao <xiaosuo@...il.com>:
> 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.
>
rx_queues can't be free from free_netdev since they contain kobjects
(only freed when refcnt goes to zero). They should be freed when the
device kobject is freed (netdev_unregister_kobject).
Tom
> Signed-off-by: Changli Gao <xiaosuo@...il.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 */
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists