From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: "David S. Miller" <davem@davemloft.net>,
ebiggers@google.com, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com,
tom@quantonium.net, viro@ZenIV.linux.org.uk,
Eric Dumazet <edumazet@google.com>
Subject: [PATCH net] kcm: Fix use-after-free caused by clonned sockets
Date: Fri, 1 Jun 2018 14:30:38 +0300 [thread overview]
Message-ID: <c1d76abc-5d6f-bd0a-9c84-1c5ed8119e8f@virtuozzo.com> (raw)
In-Reply-To: <9f485659-6d6f-9047-b9ad-b0e4084be88d@virtuozzo.com>
(resend for properly queueing in patchwork)
kcm_clone() creates kernel socket, which does not take net counter.
Thus, the net may die before the socket is completely destructed,
i.e. kcm_exit_net() is executed before kcm_done().
Reported-by: syzbot+5f1a04e374a635efc426@syzkaller.appspotmail.com
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index d67734c99027..84b7d5c6fec8 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -1671,7 +1671,7 @@ static struct file *kcm_clone(struct socket *osock)
__module_get(newsock->ops->owner);
newsk = sk_alloc(sock_net(osock->sk), PF_KCM, GFP_KERNEL,
- &kcm_proto, true);
+ &kcm_proto, false);
if (!newsk) {
sock_release(newsock);
return ERR_PTR(-ENOMEM);
next prev parent reply other threads:[~2018-06-01 11:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-31 8:16 WARNING in kcm_exit_net (3) syzbot
2018-05-31 9:58 ` Kirill Tkhai
2018-06-01 11:10 ` Kirill Tkhai
2018-06-01 11:30 ` Kirill Tkhai [this message]
2018-06-01 14:28 ` [PATCH net] kcm: Fix use-after-free caused by clonned sockets David Miller
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=c1d76abc-5d6f-bd0a-9c84-1c5ed8119e8f@virtuozzo.com \
--to=ktkhai@virtuozzo.com \
--cc=davem@davemloft.net \
--cc=ebiggers@google.com \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tom@quantonium.net \
--cc=viro@ZenIV.linux.org.uk \
/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).