aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/netlink/af_netlink.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 7a94185bde6b..d77b3467b1d4 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -994,11 +994,10 @@ static struct sock *__netlink_lookup(struct netlink_table *table, u32 portid,
994 &netlink_compare, &arg); 994 &netlink_compare, &arg);
995} 995}
996 996
997static bool __netlink_insert(struct netlink_table *table, struct sock *sk, 997static bool __netlink_insert(struct netlink_table *table, struct sock *sk)
998 struct net *net)
999{ 998{
1000 struct netlink_compare_arg arg = { 999 struct netlink_compare_arg arg = {
1001 .net = net, 1000 .net = sock_net(sk),
1002 .portid = nlk_sk(sk)->portid, 1001 .portid = nlk_sk(sk)->portid,
1003 }; 1002 };
1004 1003
@@ -1047,7 +1046,7 @@ netlink_update_listeners(struct sock *sk)
1047 * makes sure updates are visible before bind or setsockopt return. */ 1046 * makes sure updates are visible before bind or setsockopt return. */
1048} 1047}
1049 1048
1050static int netlink_insert(struct sock *sk, struct net *net, u32 portid) 1049static int netlink_insert(struct sock *sk, u32 portid)
1051{ 1050{
1052 struct netlink_table *table = &nl_table[sk->sk_protocol]; 1051 struct netlink_table *table = &nl_table[sk->sk_protocol];
1053 int err; 1052 int err;
@@ -1067,7 +1066,7 @@ static int netlink_insert(struct sock *sk, struct net *net, u32 portid)
1067 sock_hold(sk); 1066 sock_hold(sk);
1068 1067
1069 err = 0; 1068 err = 0;
1070 if (!__netlink_insert(table, sk, net)) { 1069 if (!__netlink_insert(table, sk)) {
1071 err = -EADDRINUSE; 1070 err = -EADDRINUSE;
1072 sock_put(sk); 1071 sock_put(sk);
1073 } 1072 }
@@ -1289,7 +1288,7 @@ retry:
1289 } 1288 }
1290 rcu_read_unlock(); 1289 rcu_read_unlock();
1291 1290
1292 err = netlink_insert(sk, net, portid); 1291 err = netlink_insert(sk, portid);
1293 if (err == -EADDRINUSE) 1292 if (err == -EADDRINUSE)
1294 goto retry; 1293 goto retry;
1295 1294
@@ -1477,7 +1476,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
1477 1476
1478 if (!nlk->portid) { 1477 if (!nlk->portid) {
1479 err = nladdr->nl_pid ? 1478 err = nladdr->nl_pid ?
1480 netlink_insert(sk, net, nladdr->nl_pid) : 1479 netlink_insert(sk, nladdr->nl_pid) :
1481 netlink_autobind(sock); 1480 netlink_autobind(sock);
1482 if (err) { 1481 if (err) {
1483 netlink_undo_bind(nlk->ngroups, groups, sk); 1482 netlink_undo_bind(nlk->ngroups, groups, sk);
@@ -2483,7 +2482,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module,
2483 if (cfg && cfg->input) 2482 if (cfg && cfg->input)
2484 nlk_sk(sk)->netlink_rcv = cfg->input; 2483 nlk_sk(sk)->netlink_rcv = cfg->input;
2485 2484
2486 if (netlink_insert(sk, net, 0)) 2485 if (netlink_insert(sk, 0))
2487 goto out_sock_release; 2486 goto out_sock_release;
2488 2487
2489 nlk = nlk_sk(sk); 2488 nlk = nlk_sk(sk);