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>
This commit is contained in:
committed by
David S. Miller
parent
594831a8ab
commit
273c28bc57
@@ -892,7 +892,7 @@ static void tcp_metrics_flush_all(struct net *net)
|
||||
pp = &hb->chain;
|
||||
for (tm = deref_locked(*pp); tm; tm = deref_locked(*pp)) {
|
||||
match = net ? net_eq(tm_net(tm), net) :
|
||||
!atomic_read(&tm_net(tm)->count);
|
||||
!refcount_read(&tm_net(tm)->count);
|
||||
if (match) {
|
||||
*pp = tm->tcpm_next;
|
||||
kfree_rcu(tm, rcu_head);
|
||||
|
||||
Reference in New Issue
Block a user