mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
net: Remove spinlock from get_net_ns_by_id()
idr_find() is safe under rcu_read_lock() and maybe_get_net() guarantees that net is alive. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0c06bea919
commit
42157277af
1 changed files with 0 additions and 2 deletions
|
@ -273,11 +273,9 @@ struct net *get_net_ns_by_id(struct net *net, int id)
|
|||
return NULL;
|
||||
|
||||
rcu_read_lock();
|
||||
spin_lock_bh(&net->nsid_lock);
|
||||
peer = idr_find(&net->netns_ids, id);
|
||||
if (peer)
|
||||
peer = maybe_get_net(peer);
|
||||
spin_unlock_bh(&net->nsid_lock);
|
||||
rcu_read_unlock();
|
||||
|
||||
return peer;
|
||||
|
|
Loading…
Reference in a new issue