net: Convert atomic_t net::count to refcount_t
authorKirill Tkhai <ktkhai@virtuozzo.com>
Fri, 12 Jan 2018 15:28:31 +0000 (18:28 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Jan 2018 19:23:42 +0000 (14:23 -0500)
commit273c28bc57ca9672f7b70bed764ecdfb964930c8
tree99fda63f67f8e081924a6d39af93dfbbb04e6eff
parent594831a8aba3fd045c3212a3e3bb9788c77b989d
net: Convert atomic_t net::count to refcount_t

Since net could be obtained from RCU lists,
and there is a race with net destruction,
the patch converts net::count to refcount_t.

This provides sanity checks for the cases of
incrementing counter of already dead net,
when maybe_get_net() has to used instead
of get_net().

Drivers: allyesconfig and allmodconfig are OK.

Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/net_namespace.h
net/core/net-sysfs.c
net/core/net_namespace.c
net/ipv4/inet_timewait_sock.c
net/ipv4/tcp_metrics.c