From: David Ahern <dsa@cumulusnetworks•com>
To: Nikolay Aleksandrov <razor@blackwall•org>, netdev@vger•kernel.org
Cc: shm@cumulusnetworks•com, davem@davemloft•net,
Nikolay Aleksandrov <nikolay@cumulusnetworks•com>
Subject: Re: [PATCH net-next] vrf: vrf_master_ifindex_rcu is not always called with rcu read lock
Date: Tue, 18 Aug 2015 13:45:20 -0600 [thread overview]
Message-ID: <55D38B50.1030004@cumulusnetworks.com> (raw)
In-Reply-To: <1439914666-7561-1-git-send-email-razor@blackwall.org>
On 8/18/15 10:17 AM, Nikolay Aleksandrov wrote:
> diff --git a/include/net/vrf.h b/include/net/vrf.h
> index 40e3793c7a05..22dfe2195092 100644
> --- a/include/net/vrf.h
> +++ b/include/net/vrf.h
> @@ -35,7 +35,6 @@ struct net_vrf {
>
>
> #if IS_ENABLED(CONFIG_NET_VRF)
> -/* called with rcu_read_lock() */
> static inline int vrf_master_ifindex_rcu(const struct net_device *dev)
> {
> struct net_vrf_dev *vrf_ptr;
> @@ -44,12 +43,14 @@ static inline int vrf_master_ifindex_rcu(const struct net_device *dev)
> if (!dev)
> return 0;
>
> - if (netif_is_vrf(dev))
> + if (netif_is_vrf(dev)) {
> ifindex = dev->ifindex;
> - else {
> + } else {
> + rcu_read_lock();
> vrf_ptr = rcu_dereference(dev->vrf_ptr);
> if (vrf_ptr)
> ifindex = vrf_ptr->ifindex;
> + rcu_read_unlock();
> }
>
> return ifindex;
>
The intent of the _rcu in the name is to mean it is called with
rcu_read_lock held which is the case for __fib_validate_source and
ip_route_input_slow. It looks like the icmp callers (icmp_reply and
icmp_route_lookup) are the exceptions. For those create a
static inline int vrf_master_ifindex(const struct net_device *dev)
{
}
that does the rcu lock/unlock and calls vrf_master_ifindex_rcu in between.
prev parent reply other threads:[~2015-08-18 19:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-18 16:17 [PATCH net-next] vrf: vrf_master_ifindex_rcu is not always called with rcu read lock Nikolay Aleksandrov
2015-08-18 18:15 ` [PATCH net-next v2] " Nikolay Aleksandrov
2015-08-18 20:10 ` David Ahern
2015-08-18 20:24 ` Nikolay Aleksandrov
2015-08-18 18:40 ` [PATCH net-next v3] " Nikolay Aleksandrov
2015-08-19 3:24 ` David Miller
2015-08-18 19:45 ` David Ahern [this message]
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=55D38B50.1030004@cumulusnetworks.com \
--to=dsa@cumulusnetworks$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
--cc=nikolay@cumulusnetworks$(echo .)com \
--cc=razor@blackwall$(echo .)org \
--cc=shm@cumulusnetworks$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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