aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan_core.c43
-rw-r--r--net/9p/client.c59
-rw-r--r--net/9p/trans_rdma.c4
-rw-r--r--net/core/dev.c3
-rw-r--r--net/core/scm.c24
-rw-r--r--net/core/skbuff.c12
-rw-r--r--net/ipv4/tcp.c3
-rw-r--r--net/ipv4/udp.c12
-rw-r--r--net/ipv4/xfrm4_state.c1
-rw-r--r--net/ipv6/addrconf.c4
-rw-r--r--net/ipv6/udp.c36
-rw-r--r--net/ipv6/xfrm6_state.c1
-rw-r--r--net/key/af_key.c1
-rw-r--r--net/netfilter/nf_conntrack_helper.c3
-rw-r--r--net/netfilter/nf_conntrack_proto.c5
-rw-r--r--net/rfkill/rfkill.c2
-rw-r--r--net/socket.c1
-rw-r--r--net/unix/af_unix.c2
-rw-r--r--net/xfrm/xfrm_policy.c4
-rw-r--r--net/xfrm/xfrm_user.c2
20 files changed, 155 insertions, 67 deletions
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 118adef476c3..dd86a1dc4cd0 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -3,11 +3,20 @@
3#include <linux/if_vlan.h> 3#include <linux/if_vlan.h>
4#include "vlan.h" 4#include "vlan.h"
5 5
6struct vlan_hwaccel_cb {
7 struct net_device *dev;
8};
9
10static inline struct vlan_hwaccel_cb *vlan_hwaccel_cb(struct sk_buff *skb)
11{
12 return (struct vlan_hwaccel_cb *)skb->cb;
13}
14
6/* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */ 15/* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */
7int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, 16int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
8 u16 vlan_tci, int polling) 17 u16 vlan_tci, int polling)
9{ 18{
10 struct net_device_stats *stats; 19 struct vlan_hwaccel_cb *cb = vlan_hwaccel_cb(skb);
11 20
12 if (skb_bond_should_drop(skb)) { 21 if (skb_bond_should_drop(skb)) {
13 dev_kfree_skb_any(skb); 22 dev_kfree_skb_any(skb);
@@ -15,22 +24,33 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
15 } 24 }
16 25
17 skb->vlan_tci = vlan_tci; 26 skb->vlan_tci = vlan_tci;
27 cb->dev = vlan_group_get_device(grp, vlan_tci & VLAN_VID_MASK);
28
29 return (polling ? netif_receive_skb(skb) : netif_rx(skb));
30}
31EXPORT_SYMBOL(__vlan_hwaccel_rx);
32
33int vlan_hwaccel_do_receive(struct sk_buff *skb)
34{
35 struct vlan_hwaccel_cb *cb = vlan_hwaccel_cb(skb);
36 struct net_device *dev = cb->dev;
37 struct net_device_stats *stats;
38
18 netif_nit_deliver(skb); 39 netif_nit_deliver(skb);
19 40
20 skb->dev = vlan_group_get_device(grp, vlan_tci & VLAN_VID_MASK); 41 if (dev == NULL) {
21 if (skb->dev == NULL) { 42 kfree_skb(skb);
22 dev_kfree_skb_any(skb); 43 return -1;
23 /* Not NET_RX_DROP, this is not being dropped
24 * due to congestion. */
25 return NET_RX_SUCCESS;
26 } 44 }
45
46 skb->dev = dev;
47 skb->priority = vlan_get_ingress_priority(dev, skb->vlan_tci);
27 skb->vlan_tci = 0; 48 skb->vlan_tci = 0;
28 49
29 stats = &skb->dev->stats; 50 stats = &dev->stats;
30 stats->rx_packets++; 51 stats->rx_packets++;
31 stats->rx_bytes += skb->len; 52 stats->rx_bytes += skb->len;
32 53
33 skb->priority = vlan_get_ingress_priority(skb->dev, vlan_tci);
34 switch (skb->pkt_type) { 54 switch (skb->pkt_type) {
35 case PACKET_BROADCAST: 55 case PACKET_BROADCAST:
36 break; 56 break;
@@ -42,13 +62,12 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
42 * This allows the VLAN to have a different MAC than the 62 * This allows the VLAN to have a different MAC than the
43 * underlying device, and still route correctly. */ 63 * underlying device, and still route correctly. */
44 if (!compare_ether_addr(eth_hdr(skb)->h_dest, 64 if (!compare_ether_addr(eth_hdr(skb)->h_dest,
45 skb->dev->dev_addr)) 65 dev->dev_addr))
46 skb->pkt_type = PACKET_HOST; 66 skb->pkt_type = PACKET_HOST;
47 break; 67 break;
48 }; 68 };
49 return (polling ? netif_receive_skb(skb) : netif_rx(skb)); 69 return 0;
50} 70}
51EXPORT_SYMBOL(__vlan_hwaccel_rx);
52 71
53struct net_device *vlan_dev_real_dev(const struct net_device *dev) 72struct net_device *vlan_dev_real_dev(const struct net_device *dev)
54{ 73{
diff --git a/net/9p/client.c b/net/9p/client.c
index 67717f69412e..4b529454616d 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -189,6 +189,9 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag)
189 printk(KERN_ERR "Couldn't grow tag array\n"); 189 printk(KERN_ERR "Couldn't grow tag array\n");
190 kfree(req->tc); 190 kfree(req->tc);
191 kfree(req->rc); 191 kfree(req->rc);
192 kfree(req->wq);
193 req->tc = req->rc = NULL;
194 req->wq = NULL;
192 return ERR_PTR(-ENOMEM); 195 return ERR_PTR(-ENOMEM);
193 } 196 }
194 req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall); 197 req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall);
@@ -311,12 +314,6 @@ static void p9_free_req(struct p9_client *c, struct p9_req_t *r)
311 r->status = REQ_STATUS_IDLE; 314 r->status = REQ_STATUS_IDLE;
312 if (tag != P9_NOTAG && p9_idpool_check(tag, c->tagpool)) 315 if (tag != P9_NOTAG && p9_idpool_check(tag, c->tagpool))
313 p9_idpool_put(tag, c->tagpool); 316 p9_idpool_put(tag, c->tagpool);
314
315 /* if this was a flush request we have to free response fcall */
316 if (r->rc->id == P9_RFLUSH) {
317 kfree(r->tc);
318 kfree(r->rc);
319 }
320} 317}
321 318
322/** 319/**
@@ -611,19 +608,21 @@ reterr:
611 608
612static struct p9_fid *p9_fid_create(struct p9_client *clnt) 609static struct p9_fid *p9_fid_create(struct p9_client *clnt)
613{ 610{
614 int err; 611 int ret;
615 struct p9_fid *fid; 612 struct p9_fid *fid;
613 unsigned long flags;
616 614
617 P9_DPRINTK(P9_DEBUG_FID, "clnt %p\n", clnt); 615 P9_DPRINTK(P9_DEBUG_FID, "clnt %p\n", clnt);
618 fid = kmalloc(sizeof(struct p9_fid), GFP_KERNEL); 616 fid = kmalloc(sizeof(struct p9_fid), GFP_KERNEL);
619 if (!fid) 617 if (!fid)
620 return ERR_PTR(-ENOMEM); 618 return ERR_PTR(-ENOMEM);
621 619
622 fid->fid = p9_idpool_get(clnt->fidpool); 620 ret = p9_idpool_get(clnt->fidpool);
623 if (fid->fid < 0) { 621 if (fid->fid < 0) {
624 err = -ENOSPC; 622 ret = -ENOSPC;
625 goto error; 623 goto error;
626 } 624 }
625 fid->fid = ret;
627 626
628 memset(&fid->qid, 0, sizeof(struct p9_qid)); 627 memset(&fid->qid, 0, sizeof(struct p9_qid));
629 fid->mode = -1; 628 fid->mode = -1;
@@ -632,27 +631,28 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
632 fid->clnt = clnt; 631 fid->clnt = clnt;
633 fid->aux = NULL; 632 fid->aux = NULL;
634 633
635 spin_lock(&clnt->lock); 634 spin_lock_irqsave(&clnt->lock, flags);
636 list_add(&fid->flist, &clnt->fidlist); 635 list_add(&fid->flist, &clnt->fidlist);
637 spin_unlock(&clnt->lock); 636 spin_unlock_irqrestore(&clnt->lock, flags);
638 637
639 return fid; 638 return fid;
640 639
641error: 640error:
642 kfree(fid); 641 kfree(fid);
643 return ERR_PTR(err); 642 return ERR_PTR(ret);
644} 643}
645 644
646static void p9_fid_destroy(struct p9_fid *fid) 645static void p9_fid_destroy(struct p9_fid *fid)
647{ 646{
648 struct p9_client *clnt; 647 struct p9_client *clnt;
648 unsigned long flags;
649 649
650 P9_DPRINTK(P9_DEBUG_FID, "fid %d\n", fid->fid); 650 P9_DPRINTK(P9_DEBUG_FID, "fid %d\n", fid->fid);
651 clnt = fid->clnt; 651 clnt = fid->clnt;
652 p9_idpool_put(fid->fid, clnt->fidpool); 652 p9_idpool_put(fid->fid, clnt->fidpool);
653 spin_lock(&clnt->lock); 653 spin_lock_irqsave(&clnt->lock, flags);
654 list_del(&fid->flist); 654 list_del(&fid->flist);
655 spin_unlock(&clnt->lock); 655 spin_unlock_irqrestore(&clnt->lock, flags);
656 kfree(fid); 656 kfree(fid);
657} 657}
658 658
@@ -818,7 +818,9 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
818 } 818 }
819 819
820 P9_DPRINTK(P9_DEBUG_9P, "<<< RATTACH qid %x.%llx.%x\n", 820 P9_DPRINTK(P9_DEBUG_9P, "<<< RATTACH qid %x.%llx.%x\n",
821 qid.type, qid.path, qid.version); 821 qid.type,
822 (unsigned long long)qid.path,
823 qid.version);
822 824
823 memmove(&fid->qid, &qid, sizeof(struct p9_qid)); 825 memmove(&fid->qid, &qid, sizeof(struct p9_qid));
824 826
@@ -865,7 +867,9 @@ p9_client_auth(struct p9_client *clnt, char *uname, u32 n_uname, char *aname)
865 } 867 }
866 868
867 P9_DPRINTK(P9_DEBUG_9P, "<<< RAUTH qid %x.%llx.%x\n", 869 P9_DPRINTK(P9_DEBUG_9P, "<<< RAUTH qid %x.%llx.%x\n",
868 qid.type, qid.path, qid.version); 870 qid.type,
871 (unsigned long long)qid.path,
872 qid.version);
869 873
870 memmove(&afid->qid, &qid, sizeof(struct p9_qid)); 874 memmove(&afid->qid, &qid, sizeof(struct p9_qid));
871 p9_free_req(clnt, req); 875 p9_free_req(clnt, req);
@@ -930,7 +934,8 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames,
930 934
931 for (count = 0; count < nwqids; count++) 935 for (count = 0; count < nwqids; count++)
932 P9_DPRINTK(P9_DEBUG_9P, "<<< [%d] %x.%llx.%x\n", 936 P9_DPRINTK(P9_DEBUG_9P, "<<< [%d] %x.%llx.%x\n",
933 count, wqids[count].type, wqids[count].path, 937 count, wqids[count].type,
938 (unsigned long long)wqids[count].path,
934 wqids[count].version); 939 wqids[count].version);
935 940
936 if (nwname) 941 if (nwname)
@@ -980,7 +985,9 @@ int p9_client_open(struct p9_fid *fid, int mode)
980 } 985 }
981 986
982 P9_DPRINTK(P9_DEBUG_9P, "<<< ROPEN qid %x.%llx.%x iounit %x\n", 987 P9_DPRINTK(P9_DEBUG_9P, "<<< ROPEN qid %x.%llx.%x iounit %x\n",
983 qid.type, qid.path, qid.version, iounit); 988 qid.type,
989 (unsigned long long)qid.path,
990 qid.version, iounit);
984 991
985 fid->mode = mode; 992 fid->mode = mode;
986 fid->iounit = iounit; 993 fid->iounit = iounit;
@@ -1023,7 +1030,9 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
1023 } 1030 }
1024 1031
1025 P9_DPRINTK(P9_DEBUG_9P, "<<< RCREATE qid %x.%llx.%x iounit %x\n", 1032 P9_DPRINTK(P9_DEBUG_9P, "<<< RCREATE qid %x.%llx.%x iounit %x\n",
1026 qid.type, qid.path, qid.version, iounit); 1033 qid.type,
1034 (unsigned long long)qid.path,
1035 qid.version, iounit);
1027 1036
1028 fid->mode = mode; 1037 fid->mode = mode;
1029 fid->iounit = iounit; 1038 fid->iounit = iounit;
@@ -1230,9 +1239,9 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid)
1230 "<<< name=%s uid=%s gid=%s muid=%s extension=(%s)\n" 1239 "<<< name=%s uid=%s gid=%s muid=%s extension=(%s)\n"
1231 "<<< uid=%d gid=%d n_muid=%d\n", 1240 "<<< uid=%d gid=%d n_muid=%d\n",
1232 ret->size, ret->type, ret->dev, ret->qid.type, 1241 ret->size, ret->type, ret->dev, ret->qid.type,
1233 ret->qid.path, ret->qid.version, ret->mode, 1242 (unsigned long long)ret->qid.path, ret->qid.version, ret->mode,
1234 ret->atime, ret->mtime, ret->length, ret->name, 1243 ret->atime, ret->mtime, (unsigned long long)ret->length,
1235 ret->uid, ret->gid, ret->muid, ret->extension, 1244 ret->name, ret->uid, ret->gid, ret->muid, ret->extension,
1236 ret->n_uid, ret->n_gid, ret->n_muid); 1245 ret->n_uid, ret->n_gid, ret->n_muid);
1237 1246
1238free_and_error: 1247free_and_error:
@@ -1255,9 +1264,9 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst)
1255 " name=%s uid=%s gid=%s muid=%s extension=(%s)\n" 1264 " name=%s uid=%s gid=%s muid=%s extension=(%s)\n"
1256 " uid=%d gid=%d n_muid=%d\n", 1265 " uid=%d gid=%d n_muid=%d\n",
1257 wst->size, wst->type, wst->dev, wst->qid.type, 1266 wst->size, wst->type, wst->dev, wst->qid.type,
1258 wst->qid.path, wst->qid.version, wst->mode, 1267 (unsigned long long)wst->qid.path, wst->qid.version, wst->mode,
1259 wst->atime, wst->mtime, wst->length, wst->name, 1268 wst->atime, wst->mtime, (unsigned long long)wst->length,
1260 wst->uid, wst->gid, wst->muid, wst->extension, 1269 wst->name, wst->uid, wst->gid, wst->muid, wst->extension,
1261 wst->n_uid, wst->n_gid, wst->n_muid); 1270 wst->n_uid, wst->n_gid, wst->n_muid);
1262 err = 0; 1271 err = 0;
1263 clnt = fid->clnt; 1272 clnt = fid->clnt;
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index a7fe63f704d5..2f1fe5fc1228 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -588,6 +588,9 @@ rdma_create_trans(struct p9_client *client, const char *addr, char *args)
588 if (IS_ERR(rdma->cm_id)) 588 if (IS_ERR(rdma->cm_id))
589 goto error; 589 goto error;
590 590
591 /* Associate the client with the transport */
592 client->trans = rdma;
593
591 /* Resolve the server's address */ 594 /* Resolve the server's address */
592 rdma->addr.sin_family = AF_INET; 595 rdma->addr.sin_family = AF_INET;
593 rdma->addr.sin_addr.s_addr = in_aton(addr); 596 rdma->addr.sin_addr.s_addr = in_aton(addr);
@@ -668,7 +671,6 @@ rdma_create_trans(struct p9_client *client, const char *addr, char *args)
668 if (err || (rdma->state != P9_RDMA_CONNECTED)) 671 if (err || (rdma->state != P9_RDMA_CONNECTED))
669 goto error; 672 goto error;
670 673
671 client->trans = rdma;
672 client->status = Connected; 674 client->status = Connected;
673 675
674 return 0; 676 return 0;
diff --git a/net/core/dev.c b/net/core/dev.c
index a0c60607f1a7..e0dc67a789b7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2223,6 +2223,9 @@ int netif_receive_skb(struct sk_buff *skb)
2223 int ret = NET_RX_DROP; 2223 int ret = NET_RX_DROP;
2224 __be16 type; 2224 __be16 type;
2225 2225
2226 if (skb->vlan_tci && vlan_hwaccel_do_receive(skb))
2227 return NET_RX_SUCCESS;
2228
2226 /* if we've gotten here through NAPI, check netpoll */ 2229 /* if we've gotten here through NAPI, check netpoll */
2227 if (netpoll_receive_skb(skb)) 2230 if (netpoll_receive_skb(skb))
2228 return NET_RX_DROP; 2231 return NET_RX_DROP;
diff --git a/net/core/scm.c b/net/core/scm.c
index 10f5c65f6a47..ab242cc1acca 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -75,6 +75,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp)
75 if (!fpl) 75 if (!fpl)
76 return -ENOMEM; 76 return -ENOMEM;
77 *fplp = fpl; 77 *fplp = fpl;
78 INIT_LIST_HEAD(&fpl->list);
78 fpl->count = 0; 79 fpl->count = 0;
79 } 80 }
80 fpp = &fpl->fp[fpl->count]; 81 fpp = &fpl->fp[fpl->count];
@@ -106,9 +107,25 @@ void __scm_destroy(struct scm_cookie *scm)
106 107
107 if (fpl) { 108 if (fpl) {
108 scm->fp = NULL; 109 scm->fp = NULL;
109 for (i=fpl->count-1; i>=0; i--) 110 if (current->scm_work_list) {
110 fput(fpl->fp[i]); 111 list_add_tail(&fpl->list, current->scm_work_list);
111 kfree(fpl); 112 } else {
113 LIST_HEAD(work_list);
114
115 current->scm_work_list = &work_list;
116
117 list_add(&fpl->list, &work_list);
118 while (!list_empty(&work_list)) {
119 fpl = list_first_entry(&work_list, struct scm_fp_list, list);
120
121 list_del(&fpl->list);
122 for (i=fpl->count-1; i>=0; i--)
123 fput(fpl->fp[i]);
124 kfree(fpl);
125 }
126
127 current->scm_work_list = NULL;
128 }
112 } 129 }
113} 130}
114 131
@@ -284,6 +301,7 @@ struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl)
284 301
285 new_fpl = kmalloc(sizeof(*fpl), GFP_KERNEL); 302 new_fpl = kmalloc(sizeof(*fpl), GFP_KERNEL);
286 if (new_fpl) { 303 if (new_fpl) {
304 INIT_LIST_HEAD(&new_fpl->list);
287 for (i=fpl->count-1; i>=0; i--) 305 for (i=fpl->count-1; i>=0; i--)
288 get_file(fpl->fp[i]); 306 get_file(fpl->fp[i]);
289 memcpy(new_fpl, fpl, sizeof(*fpl)); 307 memcpy(new_fpl, fpl, sizeof(*fpl));
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index c4c8a33f3418..f24a4951008b 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -449,6 +449,18 @@ void kfree_skb(struct sk_buff *skb)
449 __kfree_skb(skb); 449 __kfree_skb(skb);
450} 450}
451 451
452/**
453 * skb_recycle_check - check if skb can be reused for receive
454 * @skb: buffer
455 * @skb_size: minimum receive buffer size
456 *
457 * Checks that the skb passed in is not shared or cloned, and
458 * that it is linear and its head portion at least as large as
459 * skb_size so that it can be recycled as a receive buffer.
460 * If these conditions are met, this function does any necessary
461 * reference count dropping and cleans up the skbuff as if it
462 * just came from __alloc_skb().
463 */
452int skb_recycle_check(struct sk_buff *skb, int skb_size) 464int skb_recycle_check(struct sk_buff *skb, int skb_size)
453{ 465{
454 struct skb_shared_info *shinfo; 466 struct skb_shared_info *shinfo;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 60c28add96b8..f60a5917e54d 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1374,8 +1374,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1374 sk->sk_state == TCP_CLOSE || 1374 sk->sk_state == TCP_CLOSE ||
1375 (sk->sk_shutdown & RCV_SHUTDOWN) || 1375 (sk->sk_shutdown & RCV_SHUTDOWN) ||
1376 !timeo || 1376 !timeo ||
1377 signal_pending(current) || 1377 signal_pending(current))
1378 (flags & MSG_PEEK))
1379 break; 1378 break;
1380 } else { 1379 } else {
1381 if (sock_flag(sk, SOCK_DONE)) 1380 if (sock_flag(sk, SOCK_DONE))
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 7e4d9c871153..54badc9a019d 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -320,7 +320,7 @@ struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
320} 320}
321EXPORT_SYMBOL_GPL(udp4_lib_lookup); 321EXPORT_SYMBOL_GPL(udp4_lib_lookup);
322 322
323static inline struct sock *udp_v4_mcast_next(struct sock *sk, 323static inline struct sock *udp_v4_mcast_next(struct net *net, struct sock *sk,
324 __be16 loc_port, __be32 loc_addr, 324 __be16 loc_port, __be32 loc_addr,
325 __be16 rmt_port, __be32 rmt_addr, 325 __be16 rmt_port, __be32 rmt_addr,
326 int dif) 326 int dif)
@@ -332,7 +332,8 @@ static inline struct sock *udp_v4_mcast_next(struct sock *sk,
332 sk_for_each_from(s, node) { 332 sk_for_each_from(s, node) {
333 struct inet_sock *inet = inet_sk(s); 333 struct inet_sock *inet = inet_sk(s);
334 334
335 if (s->sk_hash != hnum || 335 if (!net_eq(sock_net(s), net) ||
336 s->sk_hash != hnum ||
336 (inet->daddr && inet->daddr != rmt_addr) || 337 (inet->daddr && inet->daddr != rmt_addr) ||
337 (inet->dport != rmt_port && inet->dport) || 338 (inet->dport != rmt_port && inet->dport) ||
338 (inet->rcv_saddr && inet->rcv_saddr != loc_addr) || 339 (inet->rcv_saddr && inet->rcv_saddr != loc_addr) ||
@@ -1131,15 +1132,16 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
1131 spin_lock(&hslot->lock); 1132 spin_lock(&hslot->lock);
1132 sk = sk_head(&hslot->head); 1133 sk = sk_head(&hslot->head);
1133 dif = skb->dev->ifindex; 1134 dif = skb->dev->ifindex;
1134 sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); 1135 sk = udp_v4_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif);
1135 if (sk) { 1136 if (sk) {
1136 struct sock *sknext = NULL; 1137 struct sock *sknext = NULL;
1137 1138
1138 do { 1139 do {
1139 struct sk_buff *skb1 = skb; 1140 struct sk_buff *skb1 = skb;
1140 1141
1141 sknext = udp_v4_mcast_next(sk_next(sk), uh->dest, daddr, 1142 sknext = udp_v4_mcast_next(net, sk_next(sk), uh->dest,
1142 uh->source, saddr, dif); 1143 daddr, uh->source, saddr,
1144 dif);
1143 if (sknext) 1145 if (sknext)
1144 skb1 = skb_clone(skb, GFP_ATOMIC); 1146 skb1 = skb_clone(skb, GFP_ATOMIC);
1145 1147
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c
index 07735ed280d7..55dc6beab9aa 100644
--- a/net/ipv4/xfrm4_state.c
+++ b/net/ipv4/xfrm4_state.c
@@ -33,6 +33,7 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl,
33 x->sel.dport_mask = htons(0xffff); 33 x->sel.dport_mask = htons(0xffff);
34 x->sel.sport = xfrm_flowi_sport(fl); 34 x->sel.sport = xfrm_flowi_sport(fl);
35 x->sel.sport_mask = htons(0xffff); 35 x->sel.sport_mask = htons(0xffff);
36 x->sel.family = AF_INET;
36 x->sel.prefixlen_d = 32; 37 x->sel.prefixlen_d = 32;
37 x->sel.prefixlen_s = 32; 38 x->sel.prefixlen_s = 32;
38 x->sel.proto = fl->proto; 39 x->sel.proto = fl->proto;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 07ee758de9e1..0e41f1be6dc9 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2483,8 +2483,10 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2483 if (!idev && dev->mtu >= IPV6_MIN_MTU) 2483 if (!idev && dev->mtu >= IPV6_MIN_MTU)
2484 idev = ipv6_add_dev(dev); 2484 idev = ipv6_add_dev(dev);
2485 2485
2486 if (idev) 2486 if (idev) {
2487 idev->if_flags |= IF_READY; 2487 idev->if_flags |= IF_READY;
2488 run_pending = 1;
2489 }
2488 } else { 2490 } else {
2489 if (!addrconf_qdisc_ok(dev)) { 2491 if (!addrconf_qdisc_ok(dev)) {
2490 /* device is still not ready. */ 2492 /* device is still not ready. */
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 32d914db6c4f..8dafa36b1ba5 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -165,6 +165,7 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
165 int peeked; 165 int peeked;
166 int err; 166 int err;
167 int is_udplite = IS_UDPLITE(sk); 167 int is_udplite = IS_UDPLITE(sk);
168 int is_udp4;
168 169
169 if (addr_len) 170 if (addr_len)
170 *addr_len=sizeof(struct sockaddr_in6); 171 *addr_len=sizeof(struct sockaddr_in6);
@@ -185,6 +186,8 @@ try_again:
185 else if (copied < ulen) 186 else if (copied < ulen)
186 msg->msg_flags |= MSG_TRUNC; 187 msg->msg_flags |= MSG_TRUNC;
187 188
189 is_udp4 = (skb->protocol == htons(ETH_P_IP));
190
188 /* 191 /*
189 * If checksum is needed at all, try to do it while copying the 192 * If checksum is needed at all, try to do it while copying the
190 * data. If the data is truncated, or if we only want a partial 193 * data. If the data is truncated, or if we only want a partial
@@ -207,9 +210,14 @@ try_again:
207 if (err) 210 if (err)
208 goto out_free; 211 goto out_free;
209 212
210 if (!peeked) 213 if (!peeked) {
211 UDP6_INC_STATS_USER(sock_net(sk), 214 if (is_udp4)
212 UDP_MIB_INDATAGRAMS, is_udplite); 215 UDP_INC_STATS_USER(sock_net(sk),
216 UDP_MIB_INDATAGRAMS, is_udplite);
217 else
218 UDP6_INC_STATS_USER(sock_net(sk),
219 UDP_MIB_INDATAGRAMS, is_udplite);
220 }
213 221
214 sock_recv_timestamp(msg, sk, skb); 222 sock_recv_timestamp(msg, sk, skb);
215 223
@@ -223,7 +231,7 @@ try_again:
223 sin6->sin6_flowinfo = 0; 231 sin6->sin6_flowinfo = 0;
224 sin6->sin6_scope_id = 0; 232 sin6->sin6_scope_id = 0;
225 233
226 if (skb->protocol == htons(ETH_P_IP)) 234 if (is_udp4)
227 ipv6_addr_set(&sin6->sin6_addr, 0, 0, 235 ipv6_addr_set(&sin6->sin6_addr, 0, 0,
228 htonl(0xffff), ip_hdr(skb)->saddr); 236 htonl(0xffff), ip_hdr(skb)->saddr);
229 else { 237 else {
@@ -234,7 +242,7 @@ try_again:
234 } 242 }
235 243
236 } 244 }
237 if (skb->protocol == htons(ETH_P_IP)) { 245 if (is_udp4) {
238 if (inet->cmsg_flags) 246 if (inet->cmsg_flags)
239 ip_cmsg_recv(msg, skb); 247 ip_cmsg_recv(msg, skb);
240 } else { 248 } else {
@@ -255,8 +263,14 @@ out:
255 263
256csum_copy_err: 264csum_copy_err:
257 lock_sock(sk); 265 lock_sock(sk);
258 if (!skb_kill_datagram(sk, skb, flags)) 266 if (!skb_kill_datagram(sk, skb, flags)) {
259 UDP6_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite); 267 if (is_udp4)
268 UDP_INC_STATS_USER(sock_net(sk),
269 UDP_MIB_INERRORS, is_udplite);
270 else
271 UDP6_INC_STATS_USER(sock_net(sk),
272 UDP_MIB_INERRORS, is_udplite);
273 }
260 release_sock(sk); 274 release_sock(sk);
261 275
262 if (flags & MSG_DONTWAIT) 276 if (flags & MSG_DONTWAIT)
@@ -355,7 +369,7 @@ drop:
355 return -1; 369 return -1;
356} 370}
357 371
358static struct sock *udp_v6_mcast_next(struct sock *sk, 372static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk,
359 __be16 loc_port, struct in6_addr *loc_addr, 373 __be16 loc_port, struct in6_addr *loc_addr,
360 __be16 rmt_port, struct in6_addr *rmt_addr, 374 __be16 rmt_port, struct in6_addr *rmt_addr,
361 int dif) 375 int dif)
@@ -367,7 +381,7 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
367 sk_for_each_from(s, node) { 381 sk_for_each_from(s, node) {
368 struct inet_sock *inet = inet_sk(s); 382 struct inet_sock *inet = inet_sk(s);
369 383
370 if (sock_net(s) != sock_net(sk)) 384 if (!net_eq(sock_net(s), net))
371 continue; 385 continue;
372 386
373 if (s->sk_hash == num && s->sk_family == PF_INET6) { 387 if (s->sk_hash == num && s->sk_family == PF_INET6) {
@@ -411,14 +425,14 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
411 spin_lock(&hslot->lock); 425 spin_lock(&hslot->lock);
412 sk = sk_head(&hslot->head); 426 sk = sk_head(&hslot->head);
413 dif = inet6_iif(skb); 427 dif = inet6_iif(skb);
414 sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); 428 sk = udp_v6_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif);
415 if (!sk) { 429 if (!sk) {
416 kfree_skb(skb); 430 kfree_skb(skb);
417 goto out; 431 goto out;
418 } 432 }
419 433
420 sk2 = sk; 434 sk2 = sk;
421 while ((sk2 = udp_v6_mcast_next(sk_next(sk2), uh->dest, daddr, 435 while ((sk2 = udp_v6_mcast_next(net, sk_next(sk2), uh->dest, daddr,
422 uh->source, saddr, dif))) { 436 uh->source, saddr, dif))) {
423 struct sk_buff *buff = skb_clone(skb, GFP_ATOMIC); 437 struct sk_buff *buff = skb_clone(skb, GFP_ATOMIC);
424 if (buff) { 438 if (buff) {
diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c
index 89884a4f23aa..60c78cfc2737 100644
--- a/net/ipv6/xfrm6_state.c
+++ b/net/ipv6/xfrm6_state.c
@@ -34,6 +34,7 @@ __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl,
34 x->sel.dport_mask = htons(0xffff); 34 x->sel.dport_mask = htons(0xffff);
35 x->sel.sport = xfrm_flowi_sport(fl); 35 x->sel.sport = xfrm_flowi_sport(fl);
36 x->sel.sport_mask = htons(0xffff); 36 x->sel.sport_mask = htons(0xffff);
37 x->sel.family = AF_INET6;
37 x->sel.prefixlen_d = 128; 38 x->sel.prefixlen_d = 128;
38 x->sel.prefixlen_s = 128; 39 x->sel.prefixlen_s = 128;
39 x->sel.proto = fl->proto; 40 x->sel.proto = fl->proto;
diff --git a/net/key/af_key.c b/net/key/af_key.c
index e55e0441e4d9..3440a4637f01 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2075,7 +2075,6 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, in
2075 req_size += socklen * 2; 2075 req_size += socklen * 2;
2076 } else { 2076 } else {
2077 size -= 2*socklen; 2077 size -= 2*socklen;
2078 socklen = 0;
2079 } 2078 }
2080 rq = (void*)skb_put(skb, req_size); 2079 rq = (void*)skb_put(skb, req_size);
2081 pol->sadb_x_policy_len += req_size/8; 2080 pol->sadb_x_policy_len += req_size/8;
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index 9c06b9f86ad4..c39b6a994133 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -21,6 +21,7 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/netdevice.h> 22#include <linux/netdevice.h>
23#include <linux/rculist.h> 23#include <linux/rculist.h>
24#include <linux/rtnetlink.h>
24 25
25#include <net/netfilter/nf_conntrack.h> 26#include <net/netfilter/nf_conntrack.h>
26#include <net/netfilter/nf_conntrack_l3proto.h> 27#include <net/netfilter/nf_conntrack_l3proto.h>
@@ -167,10 +168,12 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
167 */ 168 */
168 synchronize_rcu(); 169 synchronize_rcu();
169 170
171 rtnl_lock();
170 spin_lock_bh(&nf_conntrack_lock); 172 spin_lock_bh(&nf_conntrack_lock);
171 for_each_net(net) 173 for_each_net(net)
172 __nf_conntrack_helper_unregister(me, net); 174 __nf_conntrack_helper_unregister(me, net);
173 spin_unlock_bh(&nf_conntrack_lock); 175 spin_unlock_bh(&nf_conntrack_lock);
176 rtnl_unlock();
174} 177}
175EXPORT_SYMBOL_GPL(nf_conntrack_helper_unregister); 178EXPORT_SYMBOL_GPL(nf_conntrack_helper_unregister);
176 179
diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c
index a59a307e685d..592d73344d46 100644
--- a/net/netfilter/nf_conntrack_proto.c
+++ b/net/netfilter/nf_conntrack_proto.c
@@ -22,6 +22,7 @@
22#include <linux/notifier.h> 22#include <linux/notifier.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/netdevice.h> 24#include <linux/netdevice.h>
25#include <linux/rtnetlink.h>
25 26
26#include <net/netfilter/nf_conntrack.h> 27#include <net/netfilter/nf_conntrack.h>
27#include <net/netfilter/nf_conntrack_l3proto.h> 28#include <net/netfilter/nf_conntrack_l3proto.h>
@@ -221,8 +222,10 @@ void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto)
221 synchronize_rcu(); 222 synchronize_rcu();
222 223
223 /* Remove all contrack entries for this protocol */ 224 /* Remove all contrack entries for this protocol */
225 rtnl_lock();
224 for_each_net(net) 226 for_each_net(net)
225 nf_ct_iterate_cleanup(net, kill_l3proto, proto); 227 nf_ct_iterate_cleanup(net, kill_l3proto, proto);
228 rtnl_unlock();
226} 229}
227EXPORT_SYMBOL_GPL(nf_conntrack_l3proto_unregister); 230EXPORT_SYMBOL_GPL(nf_conntrack_l3proto_unregister);
228 231
@@ -333,8 +336,10 @@ void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *l4proto)
333 synchronize_rcu(); 336 synchronize_rcu();
334 337
335 /* Remove all contrack entries for this protocol */ 338 /* Remove all contrack entries for this protocol */
339 rtnl_lock();
336 for_each_net(net) 340 for_each_net(net)
337 nf_ct_iterate_cleanup(net, kill_l4proto, l4proto); 341 nf_ct_iterate_cleanup(net, kill_l4proto, l4proto);
342 rtnl_unlock();
338} 343}
339EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_unregister); 344EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_unregister);
340 345
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index c9180c8771c6..69f3a3b4dd61 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -666,7 +666,7 @@ static int rfkill_check_duplicity(const struct rfkill *rfkill)
666 } 666 }
667 667
668 /* 0: first switch of its kind */ 668 /* 0: first switch of its kind */
669 return test_bit(rfkill->type, seen); 669 return (test_bit(rfkill->type, seen)) ? 1 : 0;
670} 670}
671 671
672static int rfkill_add_switch(struct rfkill *rfkill) 672static int rfkill_add_switch(struct rfkill *rfkill)
diff --git a/net/socket.c b/net/socket.c
index d23cdba10d7e..d7128b761c8c 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -989,7 +989,6 @@ static int sock_close(struct inode *inode, struct file *filp)
989 printk(KERN_DEBUG "sock_close: NULL inode\n"); 989 printk(KERN_DEBUG "sock_close: NULL inode\n");
990 return 0; 990 return 0;
991 } 991 }
992 sock_fasync(-1, filp, 0);
993 sock_release(SOCKET_I(inode)); 992 sock_release(SOCKET_I(inode));
994 return 0; 993 return 0;
995} 994}
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 0b80634b2b72..7d2e4f8f8172 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2212,7 +2212,7 @@ static int unix_net_init(struct net *net)
2212#endif 2212#endif
2213 error = 0; 2213 error = 0;
2214out: 2214out:
2215 return 0; 2215 return error;
2216} 2216}
2217 2217
2218static void unix_net_exit(struct net *net) 2218static void unix_net_exit(struct net *net)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index fe596c6ef353..c546cf67801a 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -315,9 +315,9 @@ static void xfrm_policy_kill(struct xfrm_policy *policy)
315 return; 315 return;
316 } 316 }
317 317
318 spin_lock(&xfrm_policy_gc_lock); 318 spin_lock_bh(&xfrm_policy_gc_lock);
319 hlist_add_head(&policy->bydst, &xfrm_policy_gc_list); 319 hlist_add_head(&policy->bydst, &xfrm_policy_gc_list);
320 spin_unlock(&xfrm_policy_gc_lock); 320 spin_unlock_bh(&xfrm_policy_gc_lock);
321 321
322 schedule_work(&xfrm_policy_gc_work); 322 schedule_work(&xfrm_policy_gc_work);
323} 323}
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 76cf56d5d834..ee15d5dd6544 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1816,7 +1816,7 @@ static int copy_to_user_kmaddress(struct xfrm_kmaddress *k, struct sk_buff *skb)
1816 uk.family = k->family; 1816 uk.family = k->family;
1817 uk.reserved = k->reserved; 1817 uk.reserved = k->reserved;
1818 memcpy(&uk.local, &k->local, sizeof(uk.local)); 1818 memcpy(&uk.local, &k->local, sizeof(uk.local));
1819 memcpy(&uk.remote, &k->local, sizeof(uk.remote)); 1819 memcpy(&uk.remote, &k->remote, sizeof(uk.remote));
1820 1820
1821 return nla_put(skb, XFRMA_KMADDRESS, sizeof(uk), &uk); 1821 return nla_put(skb, XFRMA_KMADDRESS, sizeof(uk), &uk);
1822} 1822}