netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netdev@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH net-next 2/4] ipv6: route: make rtm_getroute not assume rtnl is locked
Date: Tue, 15 Aug 2017 16:34:42 +0200	[thread overview]
Message-ID: <20170815143444.17002-3-fw@strlen.de> (raw)
In-Reply-To: <20170815143444.17002-1-fw@strlen.de>

__dev_get_by_index assumes RTNL is held, use _rcu version instead.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/ipv6/route.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 035762fed07d..ec694fdb8cc5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3616,8 +3616,11 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 		struct net_device *dev;
 		int flags = 0;
 
-		dev = __dev_get_by_index(net, iif);
+		rcu_read_lock();
+
+		dev = dev_get_by_index_rcu(net, iif);
 		if (!dev) {
+			rcu_read_unlock();
 			err = -ENODEV;
 			goto errout;
 		}
@@ -3629,6 +3632,8 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 
 		if (!fibmatch)
 			dst = ip6_route_input_lookup(net, dev, &fl6, flags);
+
+		rcu_read_unlock();
 	} else {
 		fl6.flowi6_oif = oif;
 
-- 
2.13.0

  parent reply	other threads:[~2017-08-15 14:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 14:34 [PATCH net-next 0/4] inet: make RTM_GETROUTE work without rtnl Florian Westphal
2017-08-15 14:34 ` [PATCH net-next 1/4] selftests: add 'ip get' to rtnetlink.sh Florian Westphal
2017-08-15 14:34 ` Florian Westphal [this message]
2017-08-15 14:34 ` [PATCH net-next 3/4] ipv6: route: set ipv6 RTM_GETROUTE to not use rtnl Florian Westphal
2017-08-15 14:34 ` [PATCH net-next 4/4] ipv4: route: set ipv4 " Florian Westphal
2017-08-16  0:21 ` [PATCH net-next 0/4] inet: make RTM_GETROUTE work without rtnl 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=20170815143444.17002-3-fw@strlen.de \
    --to=fw@strlen.de \
    --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;
as well as URLs for NNTP newsgroup(s).