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 --- net/core/rtnetlink.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index dad4b1054955..8072a43196ef 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -627,6 +627,9 @@ int rtnl_link_register(struct rtnl_link_ops *ops) list_add_tail_rcu(&ops->list, &link_ops); unlock: + if (err) + cleanup_srcu_struct(&ops->srcu); + mutex_unlock(&link_ops_mutex); return err; -- 2.51.2