Commit 18889a43 authored by Herbert Xu's avatar Herbert Xu Committed by Greg Kroah-Hartman

netlink: Reset portid after netlink_insert failure

[ Upstream commit c0bb07df ]

The commit c5adde94 ("netlink:
eliminate nl_sk_hash_lock") breaks the autobind retry mechanism
because it doesn't reset portid after a failed netlink_insert.

This means that should autobind fail the first time around, then
the socket will be stuck in limbo as it can never be bound again
since it already has a non-zero portid.

Fixes: c5adde94 ("netlink: eliminate nl_sk_hash_lock")
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 94d27521
......@@ -1069,6 +1069,7 @@ static int netlink_insert(struct sock *sk, u32 portid)
err = 0;
if (!__netlink_insert(table, sk)) {
err = -EADDRINUSE;
nlk_sk(sk)->portid = 0;
sock_put(sk);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment