rtnetlink: fix leak of SRCU struct in rtnl_link_register
authorSabrina Dubroca <sd@queasysnail.net>
Mon, 23 Mar 2026 15:19:43 +0000 (16:19 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 25 Mar 2026 03:56:02 +0000 (20:56 -0700)
commit09474055f2619be9445ba4245e4013741ed01a5e
tree5c2a3e1fec625d436ad20feba86e2a92b107ff05
parent71399707876b93240f236f48b8062f3423a5fe97
rtnetlink: fix leak of SRCU struct in rtnl_link_register

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>
Link: https://patch.msgid.link/e77fe499f9a58c547b33b5212b3596dad417cec6.1774025341.git.sd@queasysnail.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/rtnetlink.c