* [syzbot] memory leak in xfrm_user_rcv_msg
@ 2021-06-22 19:04 syzbot
2021-06-24 19:12 ` Pavel Skripkin
0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2021-06-22 19:04 UTC (permalink / raw)
To: davem, herbert, kuba, linux-kernel, netdev, steffen.klassert,
syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: fd0aa1a4 Merge tag 'for-linus' of git://git.kernel.org/pub..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17464aa4300000
kernel config: https://syzkaller.appspot.com/x/.config?x=6ec2526c74098317
dashboard link: https://syzkaller.appspot.com/bug?extid=fb347cf82c73a90efcca
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14946548300000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10d28548300000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+fb347cf82c73a90efcca@syzkaller.appspotmail.com
BUG: memory leak
unreferenced object 0xffff88810f402d00 (size 232):
comm "syz-executor486", pid 8416, jiffies 4294943639 (age 13.060s)
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:
[<ffffffff836a0d5f>] __alloc_skb+0x20f/0x280 net/core/skbuff.c:413
[<ffffffff83ad5686>] alloc_skb include/linux/skbuff.h:1107 [inline]
[<ffffffff83ad5686>] xfrm_alloc_compat+0x1d6/0x6d0 net/xfrm/xfrm_compat.c:324
[<ffffffff83ad2b4c>] xfrm_alloc_userspi+0x29c/0x3f0 net/xfrm/xfrm_user.c:1448
[<ffffffff83ace7f8>] xfrm_user_rcv_msg+0x208/0x3e0 net/xfrm/xfrm_user.c:2812
[<ffffffff838233d7>] netlink_rcv_skb+0x87/0x1d0 net/netlink/af_netlink.c:2504
[<ffffffff83acc9e2>] xfrm_netlink_rcv+0x32/0x40 net/xfrm/xfrm_user.c:2824
[<ffffffff838225c2>] netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
[<ffffffff838225c2>] netlink_unicast+0x392/0x4c0 net/netlink/af_netlink.c:1340
[<ffffffff83822a58>] netlink_sendmsg+0x368/0x6a0 net/netlink/af_netlink.c:1929
[<ffffffff836908a6>] sock_sendmsg_nosec net/socket.c:654 [inline]
[<ffffffff836908a6>] sock_sendmsg+0x56/0x80 net/socket.c:674
[<ffffffff83696c6f>] sock_no_sendpage+0x8f/0xc0 net/core/sock.c:2862
[<ffffffff836901ab>] kernel_sendpage.part.0+0xeb/0x150 net/socket.c:3631
[<ffffffff83690e8b>] kernel_sendpage net/socket.c:3628 [inline]
[<ffffffff83690e8b>] sock_sendpage+0x5b/0x90 net/socket.c:947
[<ffffffff815b8872>] pipe_to_sendpage+0xa2/0x110 fs/splice.c:364
[<ffffffff815ba712>] splice_from_pipe_feed fs/splice.c:418 [inline]
[<ffffffff815ba712>] __splice_from_pipe+0x1e2/0x330 fs/splice.c:562
[<ffffffff815baf3f>] splice_from_pipe fs/splice.c:597 [inline]
[<ffffffff815baf3f>] generic_splice_sendpage+0x6f/0xa0 fs/splice.c:746
[<ffffffff815b892b>] do_splice_from fs/splice.c:767 [inline]
[<ffffffff815b892b>] direct_splice_actor+0x4b/0x70 fs/splice.c:936
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [syzbot] memory leak in xfrm_user_rcv_msg
2021-06-22 19:04 [syzbot] memory leak in xfrm_user_rcv_msg syzbot
@ 2021-06-24 19:12 ` Pavel Skripkin
2021-06-24 19:30 ` syzbot
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Skripkin @ 2021-06-24 19:12 UTC (permalink / raw)
To: syzbot
Cc: davem, herbert, kuba, linux-kernel, netdev, steffen.klassert,
syzkaller-bugs
[-- Attachment #1: Type: text/plain, Size: 921 bytes --]
On Tue, 22 Jun 2021 12:04:23 -0700
syzbot <syzbot+fb347cf82c73a90efcca@syzkaller.appspotmail.com> wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: fd0aa1a4 Merge tag 'for-linus' of
> git://git.kernel.org/pub.. git tree: upstream
> console output:
> https://syzkaller.appspot.com/x/log.txt?x=17464aa4300000 kernel
> config: https://syzkaller.appspot.com/x/.config?x=6ec2526c74098317
> dashboard link:
> https://syzkaller.appspot.com/bug?extid=fb347cf82c73a90efcca syz
> repro:
> https://syzkaller.appspot.com/x/repro.syz?x=14946548300000 C
> reproducer: https://syzkaller.appspot.com/x/repro.c?x=10d28548300000
>
> IMPORTANT: if you fix the issue, please add the following tag to the
> commit: Reported-by:
> syzbot+fb347cf82c73a90efcca@syzkaller.appspotmail.com
>
#syz test
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
With regards,
Pavel Skripkin
[-- Attachment #2: 0001-net-xfrm-fix-memory-leak-in-xfrm_user_rcv_msg.patch --]
[-- Type: text/x-patch, Size: 1064 bytes --]
From 6c124b1a50375215dcb6fae3f443a70340af1d47 Mon Sep 17 00:00:00 2001
From: Pavel Skripkin <paskripkin@gmail.com>
Date: Thu, 24 Jun 2021 22:10:25 +0300
Subject: [PATCH] net: xfrm: fix memory leak in xfrm_user_rcv_msg
/* ...... */
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
net/xfrm/xfrm_user.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index f0aecee4d539..ff60ff804074 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2811,6 +2811,16 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
err = link->doit(skb, nlh, attrs);
+ /* We need to free skb allocated in xfrm_alloc_compat() before
+ * returning from this function, because consume_skb() won't take
+ * care of frag_list since netlink destructor sets
+ * sbk->head to NULL. (see netlink_skb_destructor())
+ */
+ if (skb_has_frag_list(skb)) {
+ kfree_skb(skb_shinfo(skb)->frag_list);
+ skb_shinfo(skb)->frag_list = NULL;
+ }
+
err:
kvfree(nlh64);
return err;
--
2.32.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [syzbot] memory leak in xfrm_user_rcv_msg
2021-06-24 19:12 ` Pavel Skripkin
@ 2021-06-24 19:30 ` syzbot
0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2021-06-24 19:30 UTC (permalink / raw)
To: davem, herbert, kuba, linux-kernel, netdev, paskripkin,
steffen.klassert, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: syzbot+fb347cf82c73a90efcca@syzkaller.appspotmail.com
Tested on:
commit: 4a09d388 Merge tag 'mmc-v5.13-rc6' of git://git.kernel.org..
git tree: upstream
kernel config: https://syzkaller.appspot.com/x/.config?x=be86be9dadf57eea
dashboard link: https://syzkaller.appspot.com/bug?extid=fb347cf82c73a90efcca
compiler:
patch: https://syzkaller.appspot.com/x/patch.diff?x=14c17dbfd00000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-24 19:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 19:04 [syzbot] memory leak in xfrm_user_rcv_msg syzbot
2021-06-24 19:12 ` Pavel Skripkin
2021-06-24 19:30 ` syzbot
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).