diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/netlink/af_netlink.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 70bcd4744d93..fc456a7aaec3 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -315,8 +315,8 @@ err: | |||
315 | static void netlink_remove(struct sock *sk) | 315 | static void netlink_remove(struct sock *sk) |
316 | { | 316 | { |
317 | netlink_table_grab(); | 317 | netlink_table_grab(); |
318 | nl_table[sk->sk_protocol].hash.entries--; | 318 | if (sk_del_node_init(sk)) |
319 | sk_del_node_init(sk); | 319 | nl_table[sk->sk_protocol].hash.entries--; |
320 | if (nlk_sk(sk)->groups) | 320 | if (nlk_sk(sk)->groups) |
321 | __sk_del_bind_node(sk); | 321 | __sk_del_bind_node(sk); |
322 | netlink_table_ungrab(); | 322 | netlink_table_ungrab(); |
@@ -429,7 +429,12 @@ retry: | |||
429 | err = netlink_insert(sk, pid); | 429 | err = netlink_insert(sk, pid); |
430 | if (err == -EADDRINUSE) | 430 | if (err == -EADDRINUSE) |
431 | goto retry; | 431 | goto retry; |
432 | return 0; | 432 | |
433 | /* If 2 threads race to autobind, that is fine. */ | ||
434 | if (err == -EBUSY) | ||
435 | err = 0; | ||
436 | |||
437 | return err; | ||
433 | } | 438 | } |
434 | 439 | ||
435 | static inline int netlink_capable(struct socket *sock, unsigned int flag) | 440 | static inline int netlink_capable(struct socket *sock, unsigned int flag) |