* [PATCH v2 net] rtnetlink: fix leak of SRCU struct in rtnl_link_register
@ 2026-03-23 15:19 Sabrina Dubroca
2026-03-24 16:38 ` Kuniyuki Iwashima
2026-03-25 4:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Sabrina Dubroca @ 2026-03-23 15:19 UTC (permalink / raw)
To: netdev; +Cc: Sabrina Dubroca, Kuniyuki Iwashima, Jakub Kicinski
Commit 6b57ff21a310 ("rtnetlink: Protect link_ops by mutex.") swapped
the EEXIST check with the init_srcu_struct, but didn't add cleanup of
the SRCU struct we just allocated in case of error.
Fixes: 6b57ff21a310 ("rtnetlink: Protect link_ops by mutex.")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
net/core/rtnetlink.c | 3 +++
1 file changed, 3 insertions(+)
v2: call cleanup_srcu_struct outside link_ops_mutex, suggested by Jakub
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index dad4b1054955..ef4bf017b098 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -629,6 +629,9 @@ int rtnl_link_register(struct rtnl_link_ops *ops)
unlock:
mutex_unlock(&link_ops_mutex);
+ if (err)
+ cleanup_srcu_struct(&ops->srcu);
+
return err;
}
EXPORT_SYMBOL_GPL(rtnl_link_register);
--
2.51.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 net] rtnetlink: fix leak of SRCU struct in rtnl_link_register
2026-03-23 15:19 [PATCH v2 net] rtnetlink: fix leak of SRCU struct in rtnl_link_register Sabrina Dubroca
@ 2026-03-24 16:38 ` Kuniyuki Iwashima
2026-03-25 4:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2026-03-24 16:38 UTC (permalink / raw)
To: Sabrina Dubroca; +Cc: netdev, Jakub Kicinski
On Mon, Mar 23, 2026 at 8:19 AM Sabrina Dubroca <sd@queasysnail.net> wrote:
>
> Commit 6b57ff21a310 ("rtnetlink: Protect link_ops by mutex.") swapped
> the EEXIST check with the init_srcu_struct, but didn't add cleanup of
> the SRCU struct we just allocated in case of error.
>
> Fixes: 6b57ff21a310 ("rtnetlink: Protect link_ops by mutex.")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2 net] rtnetlink: fix leak of SRCU struct in rtnl_link_register
2026-03-23 15:19 [PATCH v2 net] rtnetlink: fix leak of SRCU struct in rtnl_link_register Sabrina Dubroca
2026-03-24 16:38 ` Kuniyuki Iwashima
@ 2026-03-25 4:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-25 4:10 UTC (permalink / raw)
To: Sabrina Dubroca; +Cc: netdev, kuniyu, kuba
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 23 Mar 2026 16:19:43 +0100 you wrote:
> Commit 6b57ff21a310 ("rtnetlink: Protect link_ops by mutex.") swapped
> the EEXIST check with the init_srcu_struct, but didn't add cleanup of
> the SRCU struct we just allocated in case of error.
>
> Fixes: 6b57ff21a310 ("rtnetlink: Protect link_ops by mutex.")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
>
> [...]
Here is the summary with links:
- [v2,net] rtnetlink: fix leak of SRCU struct in rtnl_link_register
https://git.kernel.org/netdev/net/c/09474055f261
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-25 4:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23 15:19 [PATCH v2 net] rtnetlink: fix leak of SRCU struct in rtnl_link_register Sabrina Dubroca
2026-03-24 16:38 ` Kuniyuki Iwashima
2026-03-25 4:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox