android_kernel_xiaomi_sm8350/net/core
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
..
datagram.c [NET]: Do not dereference iov if length is zero 2007-09-11 10:29:07 +02:00
dev_mcast.c [NET]: Fix race when opening a proc file while a network namespace is exiting. 2007-10-10 16:49:22 -07:00
dev.c [NET]: Fix race when opening a proc file while a network namespace is exiting. 2007-10-10 16:49:22 -07:00
dst.c [PATCH] NET : convert IP route cache garbage collection from softirq processing to a workqueue 2007-10-10 16:49:15 -07:00
ethtool.c [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
fib_rules.c [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
filter.c
flow.c mm: Remove slab destructors from kmem_cache_create(). 2007-07-20 10:11:58 +09:00
gen_estimator.c [NET]: gen_estimator deadlock fix 2007-07-18 01:46:50 -07:00
gen_stats.c
iovec.c
kmap_skb.h
link_watch.c [NET] link_watch: Always schedule urgent events 2007-05-10 23:45:28 -07:00
Makefile [NET]: Basic network namespace infrastructure. 2007-10-10 16:49:03 -07:00
neighbour.c [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
net_namespace.c [NET]: #if 0 out net_alloc() for now. 2007-10-10 16:49:14 -07:00
net-sysfs.c [NET]: Make NAPI polling independent of struct net_device objects. 2007-10-10 16:47:45 -07:00
netevent.c [NET]: net/core/netevent.c should #include <net/netevent.h> 2007-07-05 17:40:27 -07:00
netpoll.c [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
pktgen.c [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
request_sock.c
rtnetlink.c [NET]: netlink support for moving devices between network namespaces. 2007-10-10 16:49:13 -07:00
scm.c O_CLOEXEC for SCM_RIGHTS 2007-07-16 09:05:45 -07:00
skbuff.c mm: Remove slab destructors from kmem_cache_create(). 2007-07-20 10:11:58 +09:00
sock.c [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
stream.c
sysctl_net_core.c [XFRM]: Allow XFRM_ACQ_EXPIRES to be tunable via sysctl. 2007-05-31 01:23:23 -07:00
user_dma.c
utils.c [NET] net/core/utils: fix sparse warning 2007-08-07 18:02:43 -07:00