acrn-kernel/net
Eric W. Biederman 077130c0cf [NET]: Fix race when opening a proc file while a network namespace is exiting.
The problem:  proc_net files remember which network namespace the are
against but do not remember hold a reference count (as that would pin
the network namespace).   So we currently have a small window where
the reference count on a network namespace may be incremented when opening
a /proc file when it has already gone to zero.

To fix this introduce maybe_get_net and get_proc_net.

maybe_get_net increments the network namespace reference count only if it is
greater then zero, ensuring we don't increment a reference count after it
has gone to zero.

get_proc_net handles all of the magic to go from a proc inode to the network
namespace instance and call maybe_get_net on it.

PROC_NET the old accessor is removed so that we don't get confused and use
the wrong helper function.

Then I fix up the callers to use get_proc_net and handle the case case
where get_proc_net returns NULL.  In that case I return -ENXIO because
effectively the network namespace has already gone away so the files
we are trying to access don't exist anymore.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Paul E. McKenney <paulmck@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-10 16:49:22 -07:00
..
9p 9p: fix bad error path in conversion routines 2007-08-23 10:25:05 -05:00
802 [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
8021q [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
appletalk [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
atm [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
ax25 [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
bluetooth [NET]: Make socket creation namespace safe. 2007-10-10 16:49:07 -07:00
bridge [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
core [NET]: Fix race when opening a proc file while a network namespace is exiting. 2007-10-10 16:49:22 -07:00
dccp [NET]: Make /proc/net per network namespace 2007-10-10 16:49:06 -07:00
decnet [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
econet [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
ethernet [NET] ethernet: optimize memcpy and memset 2007-10-10 16:48:26 -07:00
ieee80211 [NET]: Make /proc/net per network namespace 2007-10-10 16:49:06 -07:00
ipv4 [NETLINK]: Introduce nested and byteorder flag to netlink attribute 2007-10-10 16:49:16 -07:00
ipv6 [NETLINK]: Introduce nested and byteorder flag to netlink attribute 2007-10-10 16:49:16 -07:00
ipx [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
irda [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
iucv [NET]: Make socket creation namespace safe. 2007-10-10 16:49:07 -07:00
key [NET]: Make socket creation namespace safe. 2007-10-10 16:49:07 -07:00
lapb
llc [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
mac80211 [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
netfilter [NET]: Disable netfilter sockopts when not in the initial network namespace 2007-10-10 16:49:13 -07:00
netlabel [NETLINK]: Introduce nested and byteorder flag to netlink attribute 2007-10-10 16:49:16 -07:00
netlink [NET]: Fix race when opening a proc file while a network namespace is exiting. 2007-10-10 16:49:22 -07:00
netrom [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
packet [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
rfkill [NET] RFKILL: Fix whitespace errors. 2007-07-19 10:44:38 +09:00
rose [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
rxrpc [NET]: Make socket creation namespace safe. 2007-10-10 16:49:07 -07:00
sched [NET_SCHED]: Cleanup L2T macros and handle oversized packets 2007-10-10 16:49:20 -07:00
sctp [SCTP] net/sctp/socket.c: make 3 variables static 2007-10-10 16:49:19 -07:00
sunrpc [NET]: Make /proc/net per network namespace 2007-10-10 16:49:06 -07:00
tipc [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
unix [NET]: Make socket creation namespace safe. 2007-10-10 16:49:07 -07:00
wanrouter [NET]: Make /proc/net per network namespace 2007-10-10 16:49:06 -07:00
wireless [NET]: Fix race when opening a proc file while a network namespace is exiting. 2007-10-10 16:49:22 -07:00
x25 [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
xfrm [NET]: Support multiple network namespaces with netlink 2007-10-10 16:49:09 -07:00
Kconfig 9p: Reorganization of 9p file system code 2007-07-14 15:13:40 -05:00
Makefile 9p: Reorganization of 9p file system code 2007-07-14 15:13:40 -05:00
TUNABLE
compat.c O_CLOEXEC for SCM_RIGHTS 2007-07-16 09:05:45 -07:00
nonet.c
socket.c [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
sysctl_net.c