Skip to contentSkip to conversation

netdev-genl: Hold rcu_read_lock in napi_set

PATCH Applied Joe Damato 2 participants 2 messages Nov 14, 2024 – Nov 15, 2024

Subsystems (2)
lore
Share & tools
lore

Joe Damato

author
#0 lore raw

PATCH v3 1/1 netdev-genl: Hold rcu_read_lock in napi_set

Hold rcu_read_lock during netdev_nl_napi_set_doit, which calls napi_by_id and requires rcu_read_lock to be held.

Fixes 1287c1ae0fc2 ("netdev-genl: Support setting per-NAPI config values")

---
v3:
- Separate the patches that were a series in v2 (and earlier) as they target different trees.
v2:
- Simplified by adding rcu_read_lock/unlock instead of using the helper proposed in the RFC.

 net/core/netdev-genl.c | 2 ++
 1 file changed, 2 insertions(+)
net/core/netdev-genl.c +2 -0
index 765ce7c9d73b..fa119ff68698 100644
@@ -346,6 +346,7 @@ int netdev_nl_napi_set_doit(struct sk_buff *skb, struct genl_info *info)
 	napi_id = nla_get_u32(info->attrs[NETDEV_A_NAPI_ID]);
 
 	rtnl_lock();
+	rcu_read_lock();
 
 	napi = napi_by_id(napi_id);
 	if (napi) {
@@ -355,6 +356,7 @@ int netdev_nl_napi_set_doit(struct sk_buff *skb, struct genl_info *info)
 		err = -ENOENT;
 	}
 
+	rcu_read_unlock();
 	rtnl_unlock();
 
 	return err;

base-commit: 3d12862b216d39670500f6bd44b8be312b2ee4fb

Signature · 1 line
2.25.1
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 14 Nov 2024 17:55:59 +0000 you wrote:

Hold rcu_read_lock during netdev_nl_napi_set_doit, which calls napi_by_id and requires rcu_read_lock to be held.

Fixes 1287c1ae0fc2 ("netdev-genl: Support setting per-NAPI config values")

[...]

Here is the summary with links:
- [net-next,v3] netdev-genl: Hold rcu_read_lock in napi_set

    https://git.kernel.org/netdev/net-next/c/ed7231f56cd7

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html