Commit 8ea65f4a authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

netlink: Kill redundant net argument in netlink_insert

The socket already carries the net namespace with it so there is
no need to be passing another net around.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9b3320ef
...@@ -994,11 +994,10 @@ static struct sock *__netlink_lookup(struct netlink_table *table, u32 portid, ...@@ -994,11 +994,10 @@ static struct sock *__netlink_lookup(struct netlink_table *table, u32 portid,
&netlink_compare, &arg); &netlink_compare, &arg);
} }
static bool __netlink_insert(struct netlink_table *table, struct sock *sk, static bool __netlink_insert(struct netlink_table *table, struct sock *sk)
struct net *net)
{ {
struct netlink_compare_arg arg = { struct netlink_compare_arg arg = {
.net = net, .net = sock_net(sk),
.portid = nlk_sk(sk)->portid, .portid = nlk_sk(sk)->portid,
}; };
...@@ -1047,7 +1046,7 @@ netlink_update_listeners(struct sock *sk) ...@@ -1047,7 +1046,7 @@ netlink_update_listeners(struct sock *sk)
* makes sure updates are visible before bind or setsockopt return. */ * makes sure updates are visible before bind or setsockopt return. */
} }
static int netlink_insert(struct sock *sk, struct net *net, u32 portid) static int netlink_insert(struct sock *sk, u32 portid)
{ {
struct netlink_table *table = &nl_table[sk->sk_protocol]; struct netlink_table *table = &nl_table[sk->sk_protocol];
int err; int err;
...@@ -1067,7 +1066,7 @@ static int netlink_insert(struct sock *sk, struct net *net, u32 portid) ...@@ -1067,7 +1066,7 @@ static int netlink_insert(struct sock *sk, struct net *net, u32 portid)
sock_hold(sk); sock_hold(sk);
err = 0; err = 0;
if (!__netlink_insert(table, sk, net)) { if (!__netlink_insert(table, sk)) {
err = -EADDRINUSE; err = -EADDRINUSE;
sock_put(sk); sock_put(sk);
} }
...@@ -1289,7 +1288,7 @@ static int netlink_autobind(struct socket *sock) ...@@ -1289,7 +1288,7 @@ static int netlink_autobind(struct socket *sock)
} }
rcu_read_unlock(); rcu_read_unlock();
err = netlink_insert(sk, net, portid); err = netlink_insert(sk, portid);
if (err == -EADDRINUSE) if (err == -EADDRINUSE)
goto retry; goto retry;
...@@ -1477,7 +1476,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, ...@@ -1477,7 +1476,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
if (!nlk->portid) { if (!nlk->portid) {
err = nladdr->nl_pid ? err = nladdr->nl_pid ?
netlink_insert(sk, net, nladdr->nl_pid) : netlink_insert(sk, nladdr->nl_pid) :
netlink_autobind(sock); netlink_autobind(sock);
if (err) { if (err) {
netlink_undo_bind(nlk->ngroups, groups, sk); netlink_undo_bind(nlk->ngroups, groups, sk);
...@@ -2483,7 +2482,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, ...@@ -2483,7 +2482,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module,
if (cfg && cfg->input) if (cfg && cfg->input)
nlk_sk(sk)->netlink_rcv = cfg->input; nlk_sk(sk)->netlink_rcv = cfg->input;
if (netlink_insert(sk, net, 0)) if (netlink_insert(sk, 0))
goto out_sock_release; goto out_sock_release;
nlk = nlk_sk(sk); nlk = nlk_sk(sk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment