From: dsahern@kernel.org
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, makita.toshiaki@lab.ntt.co.jp,
David Ahern <dsahern@gmail.com>
Subject: [PATCH v2 net-next] veth: Free queues on link delete
Date: Tue, 14 Aug 2018 18:04:18 -0700 [thread overview]
Message-ID: <20180815010418.5521-1-dsahern@kernel.org> (raw)
From: David Ahern <dsahern@gmail.com>
kmemleak reported new suspected memory leaks.
$ cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff8800354d5c00 (size 1024):
comm "ip", pid 836, jiffies 4294722952 (age 25.904s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<(____ptrval____)>] kmemleak_alloc+0x70/0x94
[<(____ptrval____)>] slab_post_alloc_hook+0x42/0x52
[<(____ptrval____)>] __kmalloc+0x101/0x142
[<(____ptrval____)>] kmalloc_array.constprop.20+0x1e/0x26 [veth]
[<(____ptrval____)>] veth_newlink+0x147/0x3ac [veth]
...
unreferenced object 0xffff88002e009c00 (size 1024):
comm "ip", pid 836, jiffies 4294722958 (age 25.898s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<(____ptrval____)>] kmemleak_alloc+0x70/0x94
[<(____ptrval____)>] slab_post_alloc_hook+0x42/0x52
[<(____ptrval____)>] __kmalloc+0x101/0x142
[<(____ptrval____)>] kmalloc_array.constprop.20+0x1e/0x26 [veth]
[<(____ptrval____)>] veth_newlink+0x219/0x3ac [veth]
The allocations in question are veth_alloc_queues for the dev and its peer.
Free the queues on a delete.
Fixes: 638264dc90227 ("veth: Support per queue XDP ring")
Signed-off-by: David Ahern <dsahern@gmail.com>
---
v2
- free peer dev queues as well
drivers/net/veth.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index e3202af72df5..2a3ce60631ef 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1205,6 +1205,7 @@ static void veth_dellink(struct net_device *dev, struct list_head *head)
struct veth_priv *priv;
struct net_device *peer;
+ veth_free_queues(dev);
priv = netdev_priv(dev);
peer = rtnl_dereference(priv->peer);
@@ -1216,6 +1217,7 @@ static void veth_dellink(struct net_device *dev, struct list_head *head)
unregister_netdevice_queue(dev, head);
if (peer) {
+ veth_free_queues(peer);
priv = netdev_priv(peer);
RCU_INIT_POINTER(priv->peer, NULL);
unregister_netdevice_queue(peer, head);
--
2.11.0
next reply other threads:[~2018-08-15 3:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-15 1:04 dsahern [this message]
2018-08-15 1:16 ` [PATCH v2 net-next] veth: Free queues on link delete Toshiaki Makita
2018-08-15 1:29 ` David Ahern
2018-08-15 1:32 ` Toshiaki Makita
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=20180815010418.5521-1-dsahern@kernel.org \
--to=dsahern@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=makita.toshiaki@lab.ntt.co.jp \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).