]> git.baikalelectronics.ru Git - kernel.git/commit
tun: Utilize the normal socket network namespace refcounting.
authorEric W. Biederman <ebiederm@xmission.com>
Sat, 9 May 2015 02:07:08 +0000 (21:07 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 May 2015 14:50:16 +0000 (10:50 -0400)
commit392d78df9512360242fe985f704f99c05c86e08b
treed201af832973088bc2d6c91d9b1ef68e7332f3da
parentff444044ea43259cd4d7ba4b9ed0f0387f65c836
tun: Utilize the normal socket network namespace refcounting.

There is no need for tun to do the weird network namespace refcounting.
The existing network namespace refcounting in tfile has almost exactly
the same lifetime.  So rewrite the code to use the struct sock network
namespace refcounting and remove the unnecessary hand rolled network
namespace refcounting and the unncesary tfile->net.

This change allows the tun code to directly call sock_put bypassing
sock_release and making SOCK_EXTERNALLY_ALLOCATED unnecessary.

Remove the now unncessary tun_release so that if anything tries to use
the sock_release code path the kernel will oops, and let us know about
the bug.

The macvtap code already uses it's internal socket this way.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c
include/linux/net.h
net/socket.c