diff options
| author | Kirill Tkhai <[email protected]> | 2018-01-12 15:28:31 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2018-01-15 19:23:42 +0000 |
| commit | 273c28bc57ca9672f7b70bed764ecdfb964930c8 (patch) | |
| tree | 99fda63f67f8e081924a6d39af93dfbbb04e6eff /net/ipv4/tcp_metrics.c | |
| parent | sctp: removed unused var from sctp_make_auth (diff) | |
| download | kernel-273c28bc57ca9672f7b70bed764ecdfb964930c8.tar.gz kernel-273c28bc57ca9672f7b70bed764ecdfb964930c8.zip | |
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 <[email protected]>
Signed-off-by: Kirill Tkhai <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/ipv4/tcp_metrics.c')
| -rw-r--r-- | net/ipv4/tcp_metrics.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index 759e6bc8327b..03b51cdcc731 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c @@ -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); |
