From: Vladimir Oltean <olteanv@gmail.com>
To: Nikolay Aleksandrov <nikolay@nvidia.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>,
netdev@vger.kernel.org, "Paul E . McKenney" <paulmck@kernel.org>,
rcu <rcu@vger.kernel.org>, Roopa Prabhu <roopa@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Tobias Waldekranz <tobias@waldekranz.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>
Subject: Re: [RFC PATCH net] net: dsa: tag_dsa: fix suspicious rcu_dereference_check() with br_vlan_get_pvid_rcu
Date: Thu, 30 Sep 2021 00:44:18 +0300 [thread overview]
Message-ID: <20210929214418.wwm2gpiudekspu5e@skbuf> (raw)
In-Reply-To: <d22b1596-e9ba-307c-7033-20f6a074a9df@nvidia.com>
On Thu, Sep 30, 2021 at 12:21:55AM +0300, Nikolay Aleksandrov wrote:
> To answer the question about the patch - it is correct and ok, the dereference needed
> is done inside the function and after that the value is copied. I'd only check how the
> DSA bridge pointer is handled, it seems it is dereferenced directly and I don't know
> the DSA locking rules (i.e. if anything is held by that time to ensure the pointer is
> valid). As for the patch:
> Reviewed-by: Nikolay Aleksandrov <nikolay@nvidia.com>
I think you're right in the fact that nobody ensures dp->bridge_dev
cannot be reset to NULL by dsa_port_bridge_leave(). I'll try to simulate
an issue by spin-looping for a while in the xmit function while I add
and remove the port from a bridge and see what happens. Worst case,
we'll have to add READ_ONCE and WRITE_ONCE annotations for all users,
and work with a local, on-stack reference. Because the bridge net_device
itself will not go away until the xmit itself finishes, but it's just
that it may not be our upper anymore.
prev parent reply other threads:[~2021-09-29 21:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 23:37 [RFC PATCH net] net: dsa: tag_dsa: fix suspicious rcu_dereference_check() with br_vlan_get_pvid_rcu Vladimir Oltean
2021-09-29 17:53 ` Paul E. McKenney
2021-09-29 21:28 ` Vladimir Oltean
2021-09-29 23:27 ` Paul E. McKenney
2021-09-29 21:21 ` Nikolay Aleksandrov
2021-09-29 21:44 ` Vladimir Oltean [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=20210929214418.wwm2gpiudekspu5e@skbuf \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=roopa@nvidia.com \
--cc=tobias@waldekranz.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.com \
/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