From: Pavel Skripkin <paskripkin@gmail.com>
To: syzbot <syzbot+fb347cf82c73a90efcca@syzkaller.appspotmail.com>
Cc: davem@davemloft.net, herbert@gondor.apana.org.au,
kuba@kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, steffen.klassert@secunet.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] memory leak in xfrm_user_rcv_msg
Date: Thu, 24 Jun 2021 22:12:44 +0300 [thread overview]
Message-ID: <20210624221244.3529b808@gmail.com> (raw)
In-Reply-To: <0000000000003f0bbd05c55f7511@google.com>
[-- 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
next prev parent reply other threads:[~2021-06-24 19:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-22 19:04 [syzbot] memory leak in xfrm_user_rcv_msg syzbot
2021-06-24 19:12 ` Pavel Skripkin [this message]
2021-06-24 19:30 ` syzbot
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=20210624221244.3529b808@gmail.com \
--to=paskripkin@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=syzbot+fb347cf82c73a90efcca@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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 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).