diff options
Diffstat (limited to 'net/netlink')
-rw-r--r-- | net/netlink/af_netlink.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 86bd8660a8f2..712a7bff8560 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -228,7 +228,7 @@ static inline struct sock *netlink_lookup(struct net *net, int protocol, | |||
228 | read_lock(&nl_table_lock); | 228 | read_lock(&nl_table_lock); |
229 | head = nl_pid_hashfn(hash, pid); | 229 | head = nl_pid_hashfn(hash, pid); |
230 | sk_for_each(sk, node, head) { | 230 | sk_for_each(sk, node, head) { |
231 | if ((sk->sk_net == net) && (nlk_sk(sk)->pid == pid)) { | 231 | if (sock_net(sk) == net && (nlk_sk(sk)->pid == pid)) { |
232 | sock_hold(sk); | 232 | sock_hold(sk); |
233 | goto found; | 233 | goto found; |
234 | } | 234 | } |
@@ -348,7 +348,7 @@ static int netlink_insert(struct sock *sk, struct net *net, u32 pid) | |||
348 | head = nl_pid_hashfn(hash, pid); | 348 | head = nl_pid_hashfn(hash, pid); |
349 | len = 0; | 349 | len = 0; |
350 | sk_for_each(osk, node, head) { | 350 | sk_for_each(osk, node, head) { |
351 | if ((osk->sk_net == net) && (nlk_sk(osk)->pid == pid)) | 351 | if (sock_net(osk) == net && (nlk_sk(osk)->pid == pid)) |
352 | break; | 352 | break; |
353 | len++; | 353 | len++; |
354 | } | 354 | } |
@@ -486,7 +486,7 @@ static int netlink_release(struct socket *sock) | |||
486 | 486 | ||
487 | if (nlk->pid && !nlk->subscriptions) { | 487 | if (nlk->pid && !nlk->subscriptions) { |
488 | struct netlink_notify n = { | 488 | struct netlink_notify n = { |
489 | .net = sk->sk_net, | 489 | .net = sock_net(sk), |
490 | .protocol = sk->sk_protocol, | 490 | .protocol = sk->sk_protocol, |
491 | .pid = nlk->pid, | 491 | .pid = nlk->pid, |
492 | }; | 492 | }; |
@@ -518,7 +518,7 @@ static int netlink_release(struct socket *sock) | |||
518 | static int netlink_autobind(struct socket *sock) | 518 | static int netlink_autobind(struct socket *sock) |
519 | { | 519 | { |
520 | struct sock *sk = sock->sk; | 520 | struct sock *sk = sock->sk; |
521 | struct net *net = sk->sk_net; | 521 | struct net *net = sock_net(sk); |
522 | struct nl_pid_hash *hash = &nl_table[sk->sk_protocol].hash; | 522 | struct nl_pid_hash *hash = &nl_table[sk->sk_protocol].hash; |
523 | struct hlist_head *head; | 523 | struct hlist_head *head; |
524 | struct sock *osk; | 524 | struct sock *osk; |
@@ -532,7 +532,7 @@ retry: | |||
532 | netlink_table_grab(); | 532 | netlink_table_grab(); |
533 | head = nl_pid_hashfn(hash, pid); | 533 | head = nl_pid_hashfn(hash, pid); |
534 | sk_for_each(osk, node, head) { | 534 | sk_for_each(osk, node, head) { |
535 | if ((osk->sk_net != net)) | 535 | if (sock_net(osk) != net) |
536 | continue; | 536 | continue; |
537 | if (nlk_sk(osk)->pid == pid) { | 537 | if (nlk_sk(osk)->pid == pid) { |
538 | /* Bind collision, search negative pid values. */ | 538 | /* Bind collision, search negative pid values. */ |
@@ -611,7 +611,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, | |||
611 | int addr_len) | 611 | int addr_len) |
612 | { | 612 | { |
613 | struct sock *sk = sock->sk; | 613 | struct sock *sk = sock->sk; |
614 | struct net *net = sk->sk_net; | 614 | struct net *net = sock_net(sk); |
615 | struct netlink_sock *nlk = nlk_sk(sk); | 615 | struct netlink_sock *nlk = nlk_sk(sk); |
616 | struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; | 616 | struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; |
617 | int err; | 617 | int err; |
@@ -720,7 +720,7 @@ static struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid) | |||
720 | struct sock *sock; | 720 | struct sock *sock; |
721 | struct netlink_sock *nlk; | 721 | struct netlink_sock *nlk; |
722 | 722 | ||
723 | sock = netlink_lookup(ssk->sk_net, ssk->sk_protocol, pid); | 723 | sock = netlink_lookup(sock_net(ssk), ssk->sk_protocol, pid); |
724 | if (!sock) | 724 | if (!sock) |
725 | return ERR_PTR(-ECONNREFUSED); | 725 | return ERR_PTR(-ECONNREFUSED); |
726 | 726 | ||
@@ -962,7 +962,7 @@ static inline int do_one_broadcast(struct sock *sk, | |||
962 | !test_bit(p->group - 1, nlk->groups)) | 962 | !test_bit(p->group - 1, nlk->groups)) |
963 | goto out; | 963 | goto out; |
964 | 964 | ||
965 | if ((sk->sk_net != p->net)) | 965 | if (sock_net(sk) != p->net) |
966 | goto out; | 966 | goto out; |
967 | 967 | ||
968 | if (p->failure) { | 968 | if (p->failure) { |
@@ -1006,7 +1006,7 @@ out: | |||
1006 | int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid, | 1006 | int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid, |
1007 | u32 group, gfp_t allocation) | 1007 | u32 group, gfp_t allocation) |
1008 | { | 1008 | { |
1009 | struct net *net = ssk->sk_net; | 1009 | struct net *net = sock_net(ssk); |
1010 | struct netlink_broadcast_data info; | 1010 | struct netlink_broadcast_data info; |
1011 | struct hlist_node *node; | 1011 | struct hlist_node *node; |
1012 | struct sock *sk; | 1012 | struct sock *sk; |
@@ -1064,7 +1064,7 @@ static inline int do_one_set_err(struct sock *sk, | |||
1064 | if (sk == p->exclude_sk) | 1064 | if (sk == p->exclude_sk) |
1065 | goto out; | 1065 | goto out; |
1066 | 1066 | ||
1067 | if (sk->sk_net != p->exclude_sk->sk_net) | 1067 | if (sock_net(sk) != sock_net(p->exclude_sk)) |
1068 | goto out; | 1068 | goto out; |
1069 | 1069 | ||
1070 | if (nlk->pid == p->pid || p->group - 1 >= nlk->ngroups || | 1070 | if (nlk->pid == p->pid || p->group - 1 >= nlk->ngroups || |
@@ -1601,7 +1601,7 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | |||
1601 | atomic_inc(&skb->users); | 1601 | atomic_inc(&skb->users); |
1602 | cb->skb = skb; | 1602 | cb->skb = skb; |
1603 | 1603 | ||
1604 | sk = netlink_lookup(ssk->sk_net, ssk->sk_protocol, NETLINK_CB(skb).pid); | 1604 | sk = netlink_lookup(sock_net(ssk), ssk->sk_protocol, NETLINK_CB(skb).pid); |
1605 | if (sk == NULL) { | 1605 | if (sk == NULL) { |
1606 | netlink_destroy_callback(cb); | 1606 | netlink_destroy_callback(cb); |
1607 | return -ECONNREFUSED; | 1607 | return -ECONNREFUSED; |
@@ -1643,7 +1643,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) | |||
1643 | if (!skb) { | 1643 | if (!skb) { |
1644 | struct sock *sk; | 1644 | struct sock *sk; |
1645 | 1645 | ||
1646 | sk = netlink_lookup(in_skb->sk->sk_net, | 1646 | sk = netlink_lookup(sock_net(in_skb->sk), |
1647 | in_skb->sk->sk_protocol, | 1647 | in_skb->sk->sk_protocol, |
1648 | NETLINK_CB(in_skb).pid); | 1648 | NETLINK_CB(in_skb).pid); |
1649 | if (sk) { | 1649 | if (sk) { |
@@ -1758,7 +1758,7 @@ static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos) | |||
1758 | 1758 | ||
1759 | for (j = 0; j <= hash->mask; j++) { | 1759 | for (j = 0; j <= hash->mask; j++) { |
1760 | sk_for_each(s, node, &hash->table[j]) { | 1760 | sk_for_each(s, node, &hash->table[j]) { |
1761 | if (iter->p.net != s->sk_net) | 1761 | if (sock_net(s) != iter->p.net) |
1762 | continue; | 1762 | continue; |
1763 | if (off == pos) { | 1763 | if (off == pos) { |
1764 | iter->link = i; | 1764 | iter->link = i; |
@@ -1794,7 +1794,7 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1794 | s = v; | 1794 | s = v; |
1795 | do { | 1795 | do { |
1796 | s = sk_next(s); | 1796 | s = sk_next(s); |
1797 | } while (s && (iter->p.net != s->sk_net)); | 1797 | } while (s && (sock_net(s) != iter->p.net)); |
1798 | if (s) | 1798 | if (s) |
1799 | return s; | 1799 | return s; |
1800 | 1800 | ||
@@ -1806,7 +1806,7 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1806 | 1806 | ||
1807 | for (; j <= hash->mask; j++) { | 1807 | for (; j <= hash->mask; j++) { |
1808 | s = sk_head(&hash->table[j]); | 1808 | s = sk_head(&hash->table[j]); |
1809 | while (s && (iter->p.net != s->sk_net)) | 1809 | while (s && sock_net(s) != iter->p.net) |
1810 | s = sk_next(s); | 1810 | s = sk_next(s); |
1811 | if (s) { | 1811 | if (s) { |
1812 | iter->link = i; | 1812 | iter->link = i; |