Commit 09474055 authored by Sabrina Dubroca's avatar Sabrina Dubroca Committed by Jakub Kicinski
Browse files

rtnetlink: fix leak of SRCU struct in rtnl_link_register



Commit 6b57ff21 ("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: 6b57ff21 ("rtnetlink: Protect link_ops by mutex.")
Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/e77fe499f9a58c547b33b5212b3596dad417cec6.1774025341.git.sd@queasysnail.net


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 71399707
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);