The socket already carries the net namespace with it so there is no need to be passing another net around.
Unified · Split
| @@ -994,11 +994,10 @@ static struct sock *__netlink_lookup(struct netlink_table *table, u32 portid, · 993 unmodified lines | ||
| 994 | 994 | &netlink_compare, &arg); |
| 995 | 995 | } |
| 996 | 996 | |
| 997 | −static bool __netlink_insert(struct netlink_table *table, struct sock *sk, | |
| 998 | − struct net *net) | |
| 997 | +static bool __netlink_insert(struct netlink_table *table, struct sock *sk) | |
| 999 | 998 | { |
| 1000 | 999 | struct netlink_compare_arg arg = { |
| 1001 | − .net = net, | |
| 1000 | + .net = sock_net(sk), | |
| 1002 | 1001 | .portid = nlk_sk(sk)->portid, |
| 1003 | 1002 | }; |
| 1004 | 1003 | |
| @@ -1047,7 +1046,7 @@ netlink_update_listeners(struct sock *sk) · 42 unmodified lines | ||
| 1047 | 1046 | * makes sure updates are visible before bind or setsockopt return. */ |
| 1048 | 1047 | } |
| 1049 | 1048 | |
| 1050 | −static int netlink_insert(struct sock *sk, struct net *net, u32 portid) | |
| 1049 | +static int netlink_insert(struct sock *sk, u32 portid) | |
| 1051 | 1050 | { |
| 1052 | 1051 | struct netlink_table *table = &nl_table[sk->sk_protocol]; |
| 1053 | 1052 | int err; |
| @@ -1067,7 +1066,7 @@ static int netlink_insert(struct sock *sk, struct net *net, u32 portid) · 13 unmodified lines | ||
| 1067 | 1066 | sock_hold(sk); |
| 1068 | 1067 | |
| 1069 | 1068 | err = 0; |
| 1070 | − if (!__netlink_insert(table, sk, net)) { | |
| 1069 | + if (!__netlink_insert(table, sk)) { | |
| 1071 | 1070 | err = -EADDRINUSE; |
| 1072 | 1071 | sock_put(sk); |
| 1073 | 1072 | } |
| @@ -1289,7 +1288,7 @@ retry: · 215 unmodified lines | ||
| 1289 | 1288 | } |
| 1290 | 1289 | rcu_read_unlock(); |
| 1291 | 1290 | |
| 1292 | − err = netlink_insert(sk, net, portid); | |
| 1291 | + err = netlink_insert(sk, portid); | |
| 1293 | 1292 | if (err == -EADDRINUSE) |
| 1294 | 1293 | goto retry; |
| 1295 | 1294 | |
| @@ -1477,7 +1476,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, · 181 unmodified lines | ||
| 1477 | 1476 | |
| 1478 | 1477 | if (!nlk->portid) { |
| 1479 | 1478 | err = nladdr->nl_pid ? |
| 1480 | − netlink_insert(sk, net, nladdr->nl_pid) : | |
| 1479 | + netlink_insert(sk, nladdr->nl_pid) : | |
| 1481 | 1480 | netlink_autobind(sock); |
| 1482 | 1481 | if (err) { |
| 1483 | 1482 | netlink_undo_bind(nlk->ngroups, groups, sk); |
| @@ -2483,7 +2482,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, · 999 unmodified lines | ||
| 2483 | 2482 | if (cfg && cfg->input) |
| 2484 | 2483 | nlk_sk(sk)->netlink_rcv = cfg->input; |
| 2485 | 2484 | |
| 2486 | − if (netlink_insert(sk, net, 0)) | |
| 2485 | + if (netlink_insert(sk, 0)) | |
| 2487 | 2486 | goto out_sock_release; |
| 2488 | 2487 | |
| 2489 | 2488 | nlk = nlk_sk(sk); |