[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1d76abc-5d6f-bd0a-9c84-1c5ed8119e8f@virtuozzo.com>
Date: Fri, 1 Jun 2018 14:30:38 +0300
From: Kirill Tkhai <ktkhai@...tuozzo.com>
To: "David S. Miller" <davem@...emloft.net>, ebiggers@...gle.com,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
syzkaller-bugs@...glegroups.com, tom@...ntonium.net,
viro@...IV.linux.org.uk, Eric Dumazet <edumazet@...gle.com>
Subject: [PATCH net] kcm: Fix use-after-free caused by clonned sockets
(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@...kaller.appspotmail.com
Signed-off-by: Kirill Tkhai <ktkhai@...tuozzo.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);
Powered by blists - more mailing lists