aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/netlink/af_netlink.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 01b702d63457..7a94185bde6b 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1050,7 +1050,7 @@ netlink_update_listeners(struct sock *sk)
1050static int netlink_insert(struct sock *sk, struct net *net, u32 portid) 1050static int netlink_insert(struct sock *sk, struct net *net, u32 portid)
1051{ 1051{
1052 struct netlink_table *table = &nl_table[sk->sk_protocol]; 1052 struct netlink_table *table = &nl_table[sk->sk_protocol];
1053 int err = -EADDRINUSE; 1053 int err;
1054 1054
1055 lock_sock(sk); 1055 lock_sock(sk);
1056 1056
@@ -1065,10 +1065,13 @@ static int netlink_insert(struct sock *sk, struct net *net, u32 portid)
1065 1065
1066 nlk_sk(sk)->portid = portid; 1066 nlk_sk(sk)->portid = portid;
1067 sock_hold(sk); 1067 sock_hold(sk);
1068 if (__netlink_insert(table, sk, net)) 1068
1069 err = 0; 1069 err = 0;
1070 else 1070 if (!__netlink_insert(table, sk, net)) {
1071 err = -EADDRINUSE;
1071 sock_put(sk); 1072 sock_put(sk);
1073 }
1074
1072err: 1075err:
1073 release_sock(sk); 1076 release_sock(sk);
1074 return err; 1077 return err;