From: Joe Damato <jdamato@fastly.com>
To: netdev@vger.kernel.org
Cc: pabeni@redhat.com, edumazet@google.com,
amritha.nambiar@intel.com, sridhar.samudrala@intel.com,
kuba@kernel.org, mkarsten@uwaterloo.ca,
Joe Damato <jdamato@fastly.com>,
stable@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Simon Horman <horms@kernel.org>,
Mina Almasry <almasrymina@google.com>,
linux-kernel@vger.kernel.org (open list)
Subject: [net v2 1/2] netdev-genl: Hold rcu_read_lock in napi_get
Date: Wed, 13 Nov 2024 02:17:51 +0000 [thread overview]
Message-ID: <20241113021755.11125-2-jdamato@fastly.com> (raw)
In-Reply-To: <20241113021755.11125-1-jdamato@fastly.com>
Hold rcu_read_lock in netdev_nl_napi_get_doit, which calls napi_by_id
and is required to be called under rcu_read_lock.
Cc: stable@vger.kernel.org
Fixes: 27f91aaf49b3 ("netdev-genl: Add netlink framework functions for napi")
Signed-off-by: Joe Damato <jdamato@fastly.com>
---
v2:
- Simplified by removing the helper and calling rcu_read_lock /
unlock directly instead.
net/core/netdev-genl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
index 765ce7c9d73b..0b684410b52d 100644
--- a/net/core/netdev-genl.c
+++ b/net/core/netdev-genl.c
@@ -233,6 +233,7 @@ int netdev_nl_napi_get_doit(struct sk_buff *skb, struct genl_info *info)
return -ENOMEM;
rtnl_lock();
+ rcu_read_lock();
napi = napi_by_id(napi_id);
if (napi) {
@@ -242,6 +243,7 @@ int netdev_nl_napi_get_doit(struct sk_buff *skb, struct genl_info *info)
err = -ENOENT;
}
+ rcu_read_unlock();
rtnl_unlock();
if (err)
--
2.25.1
next prev parent reply other threads:[~2024-11-13 2:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 2:17 [net v2 0/2] Fix rcu_read_lock issues in netdev-genl Joe Damato
2024-11-13 2:17 ` Joe Damato [this message]
2024-11-13 2:17 ` [net v2 2/2] netdev-genl: Hold rcu_read_lock in napi_set Joe Damato
2024-11-14 2:47 ` [net v2 0/2] Fix rcu_read_lock issues in netdev-genl Jakub Kicinski
2024-11-14 6:29 ` Joe Damato
2024-11-14 9:06 ` Paolo Abeni
2024-11-14 17:58 ` Joe Damato
2024-11-14 18:32 ` Paolo Abeni
2024-11-14 19:31 ` Jakub Kicinski
2024-11-14 20:13 ` Joe Damato
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=20241113021755.11125-2-jdamato@fastly.com \
--to=jdamato@fastly.com \
--cc=almasrymina@google.com \
--cc=amritha.nambiar@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkarsten@uwaterloo.ca \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sridhar.samudrala@intel.com \
--cc=stable@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
all inboxes | Powered by JetHome®