Netdev List
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, eric.dumazet@gmail.com,
	ebiederm@xmission.com, ktkhai@virtuozzo.com
Subject: [PATCH v3 2/2] net: Remove spinlock from get_net_ns_by_id()
Date: Tue, 16 Jan 2018 12:31:54 +0300	[thread overview]
Message-ID: <151609511167.12003.7323991178420491612.stgit@localhost.localdomain> (raw)
In-Reply-To: <151609506842.12003.15536977929261353291.stgit@localhost.localdomain>

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>
---
 net/core/net_namespace.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 3c77d84ad60d..1ccb953b3b09 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -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;

  reply	other threads:[~2018-01-16  9:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16  9:31 [PATCH v3 1/2] net: Fix possible race in peernet2id_alloc() Kirill Tkhai
2018-01-16  9:31 ` Kirill Tkhai [this message]
2018-01-17 20:43   ` [PATCH v3 2/2] net: Remove spinlock from get_net_ns_by_id() David Miller
2018-01-17 20:43 ` [PATCH v3 1/2] net: Fix possible race in peernet2id_alloc() David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=151609511167.12003.7323991178420491612.stgit@localhost.localdomain \
    --to=ktkhai@virtuozzo.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox