From: Simon Horman <horms@kernel.org>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
MD Danish Anwar <danishanwar@ti.com>,
Alexander Lobakin <aleksander.lobakin@intel.com>,
Jaakko Karrenpalo <jkarrenpalo@gmail.com>,
Fernando Fernandez Mancera <ffmancera@riseup.net>,
Murali Karicheri <m-karicheri2@ti.com>,
WingMan Kwok <w-kwok2@ti.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Xiao Liang <shaw.leon@gmail.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCHv3 net 3/3] hsr: hold rcu and dev lock for hsr_get_port_ndev
Date: Wed, 10 Sep 2025 18:09:06 +0100 [thread overview]
Message-ID: <20250910170906.GD30363@horms.kernel.org> (raw)
In-Reply-To: <20250905091533.377443-4-liuhangbin@gmail.com>
On Fri, Sep 05, 2025 at 09:15:33AM +0000, Hangbin Liu wrote:
> hsr_get_port_ndev calls hsr_for_each_port, which need to hold rcu lock.
> On the other hand, before return the port device, we need to hold the
> device reference to avoid UaF in the caller function.
>
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Fixes: 9c10dd8eed74 ("net: hsr: Create and export hsr_get_port_ndev()")
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Thanks.
I agree with your analysis.
And I see that this addresses Paolo's review over v2.
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2025-09-10 17:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 9:15 [PATCHv3 net 0/3] hsr: fix lock warnings Hangbin Liu
2025-09-05 9:15 ` [PATCHv3 net 1/3] hsr: use rtnl lock when iterating over ports Hangbin Liu
2025-09-10 17:06 ` Simon Horman
2025-09-05 9:15 ` [PATCHv3 net 2/3] hsr: use hsr_for_each_port_rtnl in hsr_port_get_hsr Hangbin Liu
2025-09-10 17:07 ` Simon Horman
2025-09-05 9:15 ` [PATCHv3 net 3/3] hsr: hold rcu and dev lock for hsr_get_port_ndev Hangbin Liu
2025-09-10 17:09 ` Simon Horman [this message]
2025-09-11 10:00 ` [PATCHv3 net 0/3] hsr: fix lock warnings patchwork-bot+netdevbpf
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=20250910170906.GD30363@horms.kernel.org \
--to=horms@kernel.org \
--cc=aleksander.lobakin@intel.com \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ffmancera@riseup.net \
--cc=jkarrenpalo@gmail.com \
--cc=johannes.berg@intel.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=liuhangbin@gmail.com \
--cc=m-karicheri2@ti.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shaw.leon@gmail.com \
--cc=w-kwok2@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.