summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-05-16 21:50:28 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-06-22 17:03:20 -0700
commit18889a4315a515de599946c945f913b6c43b1717 (patch)
tree3302267c0d5aa6bc0818234dac3905f0762c14d9 /net
parent94d27521c8152f0acf16fb4f4fef43d6de5c2cdb (diff)
netlink: Reset portid after netlink_insert failure
[ Upstream commit c0bb07df7d981e4091432754e30c9c720e2c0c78 ] The commit c5adde9468b0714a051eac7f9666f23eb10b61f7 ("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: c5adde9468b0 ("netlink: eliminate nl_sk_hash_lock") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/netlink/af_netlink.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index d1d7a8166f46..e98dc53f30ce 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -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);
}