Skip to content

Commit eb7f54b

Browse files
Kirill Tkhaidavem330
Kirill Tkhai
authored andcommitted
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: [email protected] Signed-off-by: Kirill Tkhai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 664088f commit eb7f54b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/kcm/kcmsock.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ static struct file *kcm_clone(struct socket *osock)
16711671
__module_get(newsock->ops->owner);
16721672

16731673
newsk = sk_alloc(sock_net(osock->sk), PF_KCM, GFP_KERNEL,
1674-
&kcm_proto, true);
1674+
&kcm_proto, false);
16751675
if (!newsk) {
16761676
sock_release(newsock);
16771677
return ERR_PTR(-ENOMEM);

0 commit comments

Comments
 (0)