Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "net: kernel socket should be released in init_net namespace"

This reverts commit c243d7e20996254f89c28d4838b5feca735c030d.

That patch is solving a non-existant problem while creating a
real problem. Just because a socket is allocated in the init
name space doesn't mean that it gets hashed in the init name space.

When we unhash it the name space must be the same as the one
we had when we hashed it. So this patch is completely bogus
and causes socket leaks.

Reported-by: Andrey Wagin <avagin@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Herbert Xu and committed by
David S. Miller
2e70aedd bd4d95a5

+1 -1
+1 -1
net/core/sock.c
··· 1474 1474 return; 1475 1475 1476 1476 sock_hold(sk); 1477 - sock_net_set(sk, get_net(&init_net)); 1478 1477 sock_release(sk->sk_socket); 1478 + sock_net_set(sk, get_net(&init_net)); 1479 1479 sock_put(sk); 1480 1480 } 1481 1481 EXPORT_SYMBOL(sk_release_kernel);