History

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.

Herbert Xu committed 11 years ago

Commit 8ea65f41 parent 9b3320e1 file · +7 −8Browse files

Unified · Split

net/netlink/af_netlink.c+7−8
@@ -994,11 +994,10 @@ static struct sock *__netlink_lookup(struct netlink_table *table, u32 portid, · 993 unmodified lines
994994 &netlink_compare, &arg);
995995 }
996996
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)
999998 {
1000999 struct netlink_compare_arg arg = {
1001− .net = net,
1000+ .net = sock_net(sk),
10021001 .portid = nlk_sk(sk)->portid,
10031002 };
10041003
@@ -1047,7 +1046,7 @@ netlink_update_listeners(struct sock *sk) · 42 unmodified lines
10471046 * makes sure updates are visible before bind or setsockopt return. */
10481047 }
10491048
1050−static int netlink_insert(struct sock *sk, struct net *net, u32 portid)
1049+static int netlink_insert(struct sock *sk, u32 portid)
10511050 {
10521051 struct netlink_table *table = &nl_table[sk->sk_protocol];
10531052 int err;
@@ -1067,7 +1066,7 @@ static int netlink_insert(struct sock *sk, struct net *net, u32 portid) · 13 unmodified lines
10671066 sock_hold(sk);
10681067
10691068 err = 0;
1070− if (!__netlink_insert(table, sk, net)) {
1069+ if (!__netlink_insert(table, sk)) {
10711070 err = -EADDRINUSE;
10721071 sock_put(sk);
10731072 }
@@ -1289,7 +1288,7 @@ retry: · 215 unmodified lines
12891288 }
12901289 rcu_read_unlock();
12911290
1292− err = netlink_insert(sk, net, portid);
1291+ err = netlink_insert(sk, portid);
12931292 if (err == -EADDRINUSE)
12941293 goto retry;
12951294
@@ -1477,7 +1476,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, · 181 unmodified lines
14771476
14781477 if (!nlk->portid) {
14791478 err = nladdr->nl_pid ?
1480− netlink_insert(sk, net, nladdr->nl_pid) :
1479+ netlink_insert(sk, nladdr->nl_pid) :
14811480 netlink_autobind(sock);
14821481 if (err) {
14831482 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
24832482 if (cfg && cfg->input)
24842483 nlk_sk(sk)->netlink_rcv = cfg->input;
24852484
2486− if (netlink_insert(sk, net, 0))
2485+ if (netlink_insert(sk, 0))
24872486 goto out_sock_release;
24882487
24892488 nlk = nlk_sk(sk);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t