]> git.karo-electronics.de Git - linux-beck.git/commitdiff
tipc: set kern=0 in sk_alloc() during tipc_accept()
authorParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Tue, 1 Nov 2016 13:02:36 +0000 (14:02 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 1 Nov 2016 15:53:23 +0000 (11:53 -0400)
Until now, tipc_accept() calls sk_alloc() with kern=1. This is
incorrect as the data socket's owner is the user application.
Thus for these accepted data sockets the network namespace
refcount is skipped.

In this commit, we fix this by setting kern=0.

Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/socket.c

index cd01deb1da9cee495e02e944d7b0fc6ace551ee7..82aec2eb8497e960633542eb6c7d18882f2cd8e5 100644 (file)
@@ -2093,7 +2093,7 @@ static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags)
 
        buf = skb_peek(&sk->sk_receive_queue);
 
-       res = tipc_sk_create(sock_net(sock->sk), new_sock, 0, 1);
+       res = tipc_sk_create(sock_net(sock->sk), new_sock, 0, 0);
        if (res)
                goto exit;
        security_sk_clone(sock->sk, new_sock->sk);