aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan_dev.c10
-rw-r--r--net/bridge/netfilter/ebt_ulog.c7
-rw-r--r--net/core/neighbour.c6
-rw-r--r--net/core/skbuff.c1
-rw-r--r--net/dccp/ipv4.c1
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c1
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c4
-rw-r--r--net/ipv4/netfilter/nf_nat_snmp_basic.c22
-rw-r--r--net/ipv4/tcp_ipv4.c23
-rw-r--r--net/ipv4/udp.c30
-rw-r--r--net/ipv4/udplite.c13
-rw-r--r--net/ipv6/netfilter.c13
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c7
-rw-r--r--net/ipv6/tcp_ipv6.c12
-rw-r--r--net/ipv6/udp.c12
-rw-r--r--net/ipv6/udplite.c13
-rw-r--r--net/l2tp/l2tp_core.c3
-rw-r--r--net/netfilter/core.c11
-rw-r--r--net/netfilter/ipset/ip_set_core.c4
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c20
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c22
-rw-r--r--net/netfilter/ipvs/ip_vs_dh.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_ftp.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_lblc.c9
-rw-r--r--net/netfilter/ipvs/ip_vs_lblcr.c13
-rw-r--r--net/netfilter/ipvs/ip_vs_nfct.c2
-rw-r--r--net/netfilter/ipvs/ip_vs_proto.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_proto_sctp.c14
-rw-r--r--net/netfilter/ipvs/ip_vs_proto_tcp.c6
-rw-r--r--net/netfilter/ipvs/ip_vs_proto_udp.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_sh.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_wrr.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_xmit.c2
-rw-r--r--net/netfilter/nf_conntrack_core.c5
-rw-r--r--net/netfilter/nfnetlink_log.c7
-rw-r--r--net/netfilter/xt_IDLETIMER.c2
-rw-r--r--net/netfilter/xt_hashlimit.c5
-rw-r--r--net/packet/af_packet.c52
-rw-r--r--net/x25/af_x25.c11
39 files changed, 185 insertions, 208 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index c8cf9391417e..bc2528624583 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -470,10 +470,12 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
470{ 470{
471 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 471 struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
472 472
473 if (change & IFF_ALLMULTI) 473 if (dev->flags & IFF_UP) {
474 dev_set_allmulti(real_dev, dev->flags & IFF_ALLMULTI ? 1 : -1); 474 if (change & IFF_ALLMULTI)
475 if (change & IFF_PROMISC) 475 dev_set_allmulti(real_dev, dev->flags & IFF_ALLMULTI ? 1 : -1);
476 dev_set_promiscuity(real_dev, dev->flags & IFF_PROMISC ? 1 : -1); 476 if (change & IFF_PROMISC)
477 dev_set_promiscuity(real_dev, dev->flags & IFF_PROMISC ? 1 : -1);
478 }
477} 479}
478 480
479static void vlan_dev_set_rx_mode(struct net_device *vlan_dev) 481static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c
index bf2a333ca7c7..5449294bdd5e 100644
--- a/net/bridge/netfilter/ebt_ulog.c
+++ b/net/bridge/netfilter/ebt_ulog.c
@@ -102,16 +102,15 @@ static struct sk_buff *ulog_alloc_skb(unsigned int size)
102 unsigned int n; 102 unsigned int n;
103 103
104 n = max(size, nlbufsiz); 104 n = max(size, nlbufsiz);
105 skb = alloc_skb(n, GFP_ATOMIC); 105 skb = alloc_skb(n, GFP_ATOMIC | __GFP_NOWARN);
106 if (!skb) { 106 if (!skb) {
107 pr_debug("cannot alloc whole buffer of size %ub!\n", n);
108 if (n > size) { 107 if (n > size) {
109 /* try to allocate only as much as we need for 108 /* try to allocate only as much as we need for
110 * current packet */ 109 * current packet */
111 skb = alloc_skb(size, GFP_ATOMIC); 110 skb = alloc_skb(size, GFP_ATOMIC);
112 if (!skb) 111 if (!skb)
113 pr_debug("cannot even allocate " 112 pr_debug("cannot even allocate buffer of size %ub\n",
114 "buffer of size %ub\n", size); 113 size);
115 } 114 }
116 } 115 }
117 116
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 909ecb3c2a33..039d51e6c284 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -872,12 +872,8 @@ static void neigh_timer_handler(unsigned long arg)
872 now = jiffies; 872 now = jiffies;
873 next = now + HZ; 873 next = now + HZ;
874 874
875 if (!(state & NUD_IN_TIMER)) { 875 if (!(state & NUD_IN_TIMER))
876#ifndef CONFIG_SMP
877 printk(KERN_WARNING "neigh: timer & !nud_in_timer\n");
878#endif
879 goto out; 876 goto out;
880 }
881 877
882 if (state & NUD_REACHABLE) { 878 if (state & NUD_REACHABLE) {
883 if (time_before_eq(now, 879 if (time_before_eq(now,
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index ca4db40e75b8..18a3cebb753d 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -189,6 +189,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
189 * aligned memory blocks, unless SLUB/SLAB debug is enabled. 189 * aligned memory blocks, unless SLUB/SLAB debug is enabled.
190 * Both skb->head and skb_shared_info are cache line aligned. 190 * Both skb->head and skb_shared_info are cache line aligned.
191 */ 191 */
192 size = SKB_DATA_ALIGN(size);
192 size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); 193 size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
193 data = kmalloc_node_track_caller(size, gfp_mask, node); 194 data = kmalloc_node_track_caller(size, gfp_mask, node);
194 if (!data) 195 if (!data)
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 332639b56f4d..90a919afbed7 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -433,6 +433,7 @@ exit:
433 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); 433 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
434 return NULL; 434 return NULL;
435put_and_exit: 435put_and_exit:
436 bh_unlock_sock(newsk);
436 sock_put(newsk); 437 sock_put(newsk);
437 goto exit; 438 goto exit;
438} 439}
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index db8d22db425f..a639967eb727 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -395,7 +395,6 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par)
395 config = clusterip_config_init(cipinfo, 395 config = clusterip_config_init(cipinfo,
396 e->ip.dst.s_addr, dev); 396 e->ip.dst.s_addr, dev);
397 if (!config) { 397 if (!config) {
398 pr_info("cannot allocate config\n");
399 dev_put(dev); 398 dev_put(dev);
400 return -ENOMEM; 399 return -ENOMEM;
401 } 400 }
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index 446e0f467a17..b5508151e547 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -135,10 +135,8 @@ static struct sk_buff *ulog_alloc_skb(unsigned int size)
135 * due to slab allocator restrictions */ 135 * due to slab allocator restrictions */
136 136
137 n = max(size, nlbufsiz); 137 n = max(size, nlbufsiz);
138 skb = alloc_skb(n, GFP_ATOMIC); 138 skb = alloc_skb(n, GFP_ATOMIC | __GFP_NOWARN);
139 if (!skb) { 139 if (!skb) {
140 pr_debug("cannot alloc whole buffer %ub!\n", n);
141
142 if (n > size) { 140 if (n > size) {
143 /* try to allocate only as much as we need for 141 /* try to allocate only as much as we need for
144 * current packet */ 142 * current packet */
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
index d1cb412c18e0..2133c30a4a5f 100644
--- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
@@ -400,11 +400,8 @@ static unsigned char asn1_octets_decode(struct asn1_ctx *ctx,
400 *len = 0; 400 *len = 0;
401 401
402 *octets = kmalloc(eoc - ctx->pointer, GFP_ATOMIC); 402 *octets = kmalloc(eoc - ctx->pointer, GFP_ATOMIC);
403 if (*octets == NULL) { 403 if (*octets == NULL)
404 if (net_ratelimit())
405 pr_notice("OOM in bsalg (%d)\n", __LINE__);
406 return 0; 404 return 0;
407 }
408 405
409 ptr = *octets; 406 ptr = *octets;
410 while (ctx->pointer < eoc) { 407 while (ctx->pointer < eoc) {
@@ -451,11 +448,8 @@ static unsigned char asn1_oid_decode(struct asn1_ctx *ctx,
451 return 0; 448 return 0;
452 449
453 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC); 450 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
454 if (*oid == NULL) { 451 if (*oid == NULL)
455 if (net_ratelimit())
456 pr_notice("OOM in bsalg (%d)\n", __LINE__);
457 return 0; 452 return 0;
458 }
459 453
460 optr = *oid; 454 optr = *oid;
461 455
@@ -728,8 +722,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
728 *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); 722 *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
729 if (*obj == NULL) { 723 if (*obj == NULL) {
730 kfree(id); 724 kfree(id);
731 if (net_ratelimit())
732 pr_notice("OOM in bsalg (%d)\n", __LINE__);
733 return 0; 725 return 0;
734 } 726 }
735 (*obj)->syntax.l[0] = l; 727 (*obj)->syntax.l[0] = l;
@@ -744,8 +736,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
744 if (*obj == NULL) { 736 if (*obj == NULL) {
745 kfree(p); 737 kfree(p);
746 kfree(id); 738 kfree(id);
747 if (net_ratelimit())
748 pr_notice("OOM in bsalg (%d)\n", __LINE__);
749 return 0; 739 return 0;
750 } 740 }
751 memcpy((*obj)->syntax.c, p, len); 741 memcpy((*obj)->syntax.c, p, len);
@@ -759,8 +749,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
759 *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC); 749 *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC);
760 if (*obj == NULL) { 750 if (*obj == NULL) {
761 kfree(id); 751 kfree(id);
762 if (net_ratelimit())
763 pr_notice("OOM in bsalg (%d)\n", __LINE__);
764 return 0; 752 return 0;
765 } 753 }
766 if (!asn1_null_decode(ctx, end)) { 754 if (!asn1_null_decode(ctx, end)) {
@@ -780,8 +768,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
780 if (*obj == NULL) { 768 if (*obj == NULL) {
781 kfree(lp); 769 kfree(lp);
782 kfree(id); 770 kfree(id);
783 if (net_ratelimit())
784 pr_notice("OOM in bsalg (%d)\n", __LINE__);
785 return 0; 771 return 0;
786 } 772 }
787 memcpy((*obj)->syntax.ul, lp, len); 773 memcpy((*obj)->syntax.ul, lp, len);
@@ -801,8 +787,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
801 if (*obj == NULL) { 787 if (*obj == NULL) {
802 kfree(p); 788 kfree(p);
803 kfree(id); 789 kfree(id);
804 if (net_ratelimit())
805 pr_notice("OOM in bsalg (%d)\n", __LINE__);
806 return 0; 790 return 0;
807 } 791 }
808 memcpy((*obj)->syntax.uc, p, len); 792 memcpy((*obj)->syntax.uc, p, len);
@@ -819,8 +803,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
819 *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); 803 *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
820 if (*obj == NULL) { 804 if (*obj == NULL) {
821 kfree(id); 805 kfree(id);
822 if (net_ratelimit())
823 pr_notice("OOM in bsalg (%d)\n", __LINE__);
824 return 0; 806 return 0;
825 } 807 }
826 (*obj)->syntax.ul[0] = ul; 808 (*obj)->syntax.ul[0] = ul;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 0ea10eefa60f..a7443159c400 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1510,6 +1510,7 @@ exit:
1510 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); 1510 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
1511 return NULL; 1511 return NULL;
1512put_and_exit: 1512put_and_exit:
1513 bh_unlock_sock(newsk);
1513 sock_put(newsk); 1514 sock_put(newsk);
1514 goto exit; 1515 goto exit;
1515} 1516}
@@ -2339,7 +2340,7 @@ static void tcp_seq_stop(struct seq_file *seq, void *v)
2339 } 2340 }
2340} 2341}
2341 2342
2342static int tcp_seq_open(struct inode *inode, struct file *file) 2343int tcp_seq_open(struct inode *inode, struct file *file)
2343{ 2344{
2344 struct tcp_seq_afinfo *afinfo = PDE(inode)->data; 2345 struct tcp_seq_afinfo *afinfo = PDE(inode)->data;
2345 struct tcp_iter_state *s; 2346 struct tcp_iter_state *s;
@@ -2355,23 +2356,19 @@ static int tcp_seq_open(struct inode *inode, struct file *file)
2355 s->last_pos = 0; 2356 s->last_pos = 0;
2356 return 0; 2357 return 0;
2357} 2358}
2359EXPORT_SYMBOL(tcp_seq_open);
2358 2360
2359int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo) 2361int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
2360{ 2362{
2361 int rc = 0; 2363 int rc = 0;
2362 struct proc_dir_entry *p; 2364 struct proc_dir_entry *p;
2363 2365
2364 afinfo->seq_fops.open = tcp_seq_open;
2365 afinfo->seq_fops.read = seq_read;
2366 afinfo->seq_fops.llseek = seq_lseek;
2367 afinfo->seq_fops.release = seq_release_net;
2368
2369 afinfo->seq_ops.start = tcp_seq_start; 2366 afinfo->seq_ops.start = tcp_seq_start;
2370 afinfo->seq_ops.next = tcp_seq_next; 2367 afinfo->seq_ops.next = tcp_seq_next;
2371 afinfo->seq_ops.stop = tcp_seq_stop; 2368 afinfo->seq_ops.stop = tcp_seq_stop;
2372 2369
2373 p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net, 2370 p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,
2374 &afinfo->seq_fops, afinfo); 2371 afinfo->seq_fops, afinfo);
2375 if (!p) 2372 if (!p)
2376 rc = -ENOMEM; 2373 rc = -ENOMEM;
2377 return rc; 2374 return rc;
@@ -2520,12 +2517,18 @@ out:
2520 return 0; 2517 return 0;
2521} 2518}
2522 2519
2520static const struct file_operations tcp_afinfo_seq_fops = {
2521 .owner = THIS_MODULE,
2522 .open = tcp_seq_open,
2523 .read = seq_read,
2524 .llseek = seq_lseek,
2525 .release = seq_release_net
2526};
2527
2523static struct tcp_seq_afinfo tcp4_seq_afinfo = { 2528static struct tcp_seq_afinfo tcp4_seq_afinfo = {
2524 .name = "tcp", 2529 .name = "tcp",
2525 .family = AF_INET, 2530 .family = AF_INET,
2526 .seq_fops = { 2531 .seq_fops = &tcp_afinfo_seq_fops,
2527 .owner = THIS_MODULE,
2528 },
2529 .seq_ops = { 2532 .seq_ops = {
2530 .show = tcp4_seq_show, 2533 .show = tcp4_seq_show,
2531 }, 2534 },
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index ebaa96bd3464..ab0966df1e2a 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1397,6 +1397,8 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1397 nf_reset(skb); 1397 nf_reset(skb);
1398 1398
1399 if (up->encap_type) { 1399 if (up->encap_type) {
1400 int (*encap_rcv)(struct sock *sk, struct sk_buff *skb);
1401
1400 /* 1402 /*
1401 * This is an encapsulation socket so pass the skb to 1403 * This is an encapsulation socket so pass the skb to
1402 * the socket's udp_encap_rcv() hook. Otherwise, just 1404 * the socket's udp_encap_rcv() hook. Otherwise, just
@@ -1409,11 +1411,11 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1409 */ 1411 */
1410 1412
1411 /* if we're overly short, let UDP handle it */ 1413 /* if we're overly short, let UDP handle it */
1412 if (skb->len > sizeof(struct udphdr) && 1414 encap_rcv = ACCESS_ONCE(up->encap_rcv);
1413 up->encap_rcv != NULL) { 1415 if (skb->len > sizeof(struct udphdr) && encap_rcv != NULL) {
1414 int ret; 1416 int ret;
1415 1417
1416 ret = (*up->encap_rcv)(sk, skb); 1418 ret = encap_rcv(sk, skb);
1417 if (ret <= 0) { 1419 if (ret <= 0) {
1418 UDP_INC_STATS_BH(sock_net(sk), 1420 UDP_INC_STATS_BH(sock_net(sk),
1419 UDP_MIB_INDATAGRAMS, 1421 UDP_MIB_INDATAGRAMS,
@@ -2037,7 +2039,7 @@ static void udp_seq_stop(struct seq_file *seq, void *v)
2037 spin_unlock_bh(&state->udp_table->hash[state->bucket].lock); 2039 spin_unlock_bh(&state->udp_table->hash[state->bucket].lock);
2038} 2040}
2039 2041
2040static int udp_seq_open(struct inode *inode, struct file *file) 2042int udp_seq_open(struct inode *inode, struct file *file)
2041{ 2043{
2042 struct udp_seq_afinfo *afinfo = PDE(inode)->data; 2044 struct udp_seq_afinfo *afinfo = PDE(inode)->data;
2043 struct udp_iter_state *s; 2045 struct udp_iter_state *s;
@@ -2053,6 +2055,7 @@ static int udp_seq_open(struct inode *inode, struct file *file)
2053 s->udp_table = afinfo->udp_table; 2055 s->udp_table = afinfo->udp_table;
2054 return err; 2056 return err;
2055} 2057}
2058EXPORT_SYMBOL(udp_seq_open);
2056 2059
2057/* ------------------------------------------------------------------------ */ 2060/* ------------------------------------------------------------------------ */
2058int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo) 2061int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
@@ -2060,17 +2063,12 @@ int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
2060 struct proc_dir_entry *p; 2063 struct proc_dir_entry *p;
2061 int rc = 0; 2064 int rc = 0;
2062 2065
2063 afinfo->seq_fops.open = udp_seq_open;
2064 afinfo->seq_fops.read = seq_read;
2065 afinfo->seq_fops.llseek = seq_lseek;
2066 afinfo->seq_fops.release = seq_release_net;
2067
2068 afinfo->seq_ops.start = udp_seq_start; 2066 afinfo->seq_ops.start = udp_seq_start;
2069 afinfo->seq_ops.next = udp_seq_next; 2067 afinfo->seq_ops.next = udp_seq_next;
2070 afinfo->seq_ops.stop = udp_seq_stop; 2068 afinfo->seq_ops.stop = udp_seq_stop;
2071 2069
2072 p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net, 2070 p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,
2073 &afinfo->seq_fops, afinfo); 2071 afinfo->seq_fops, afinfo);
2074 if (!p) 2072 if (!p)
2075 rc = -ENOMEM; 2073 rc = -ENOMEM;
2076 return rc; 2074 return rc;
@@ -2120,14 +2118,20 @@ int udp4_seq_show(struct seq_file *seq, void *v)
2120 return 0; 2118 return 0;
2121} 2119}
2122 2120
2121static const struct file_operations udp_afinfo_seq_fops = {
2122 .owner = THIS_MODULE,
2123 .open = udp_seq_open,
2124 .read = seq_read,
2125 .llseek = seq_lseek,
2126 .release = seq_release_net
2127};
2128
2123/* ------------------------------------------------------------------------ */ 2129/* ------------------------------------------------------------------------ */
2124static struct udp_seq_afinfo udp4_seq_afinfo = { 2130static struct udp_seq_afinfo udp4_seq_afinfo = {
2125 .name = "udp", 2131 .name = "udp",
2126 .family = AF_INET, 2132 .family = AF_INET,
2127 .udp_table = &udp_table, 2133 .udp_table = &udp_table,
2128 .seq_fops = { 2134 .seq_fops = &udp_afinfo_seq_fops,
2129 .owner = THIS_MODULE,
2130 },
2131 .seq_ops = { 2135 .seq_ops = {
2132 .show = udp4_seq_show, 2136 .show = udp4_seq_show,
2133 }, 2137 },
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index aee9963f7f5a..08383eb54208 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -71,13 +71,20 @@ static struct inet_protosw udplite4_protosw = {
71}; 71};
72 72
73#ifdef CONFIG_PROC_FS 73#ifdef CONFIG_PROC_FS
74
75static const struct file_operations udplite_afinfo_seq_fops = {
76 .owner = THIS_MODULE,
77 .open = udp_seq_open,
78 .read = seq_read,
79 .llseek = seq_lseek,
80 .release = seq_release_net
81};
82
74static struct udp_seq_afinfo udplite4_seq_afinfo = { 83static struct udp_seq_afinfo udplite4_seq_afinfo = {
75 .name = "udplite", 84 .name = "udplite",
76 .family = AF_INET, 85 .family = AF_INET,
77 .udp_table = &udplite_table, 86 .udp_table = &udplite_table,
78 .seq_fops = { 87 .seq_fops = &udplite_afinfo_seq_fops,
79 .owner = THIS_MODULE,
80 },
81 .seq_ops = { 88 .seq_ops = {
82 .show = udp4_seq_show, 89 .show = udp4_seq_show,
83 }, 90 },
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index 30fcee465448..8992cf6651d4 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -100,9 +100,16 @@ static int nf_ip6_route(struct net *net, struct dst_entry **dst,
100 .pinet6 = (struct ipv6_pinfo *) &fake_pinfo, 100 .pinet6 = (struct ipv6_pinfo *) &fake_pinfo,
101 }; 101 };
102 const void *sk = strict ? &fake_sk : NULL; 102 const void *sk = strict ? &fake_sk : NULL;
103 103 struct dst_entry *result;
104 *dst = ip6_route_output(net, sk, &fl->u.ip6); 104 int err;
105 return (*dst)->error; 105
106 result = ip6_route_output(net, sk, &fl->u.ip6);
107 err = result->error;
108 if (err)
109 dst_release(result);
110 else
111 *dst = result;
112 return err;
106} 113}
107 114
108__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, 115__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index e8762c73b170..38f00b0298d3 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -182,7 +182,6 @@ fq_find(__be32 id, u32 user, struct in6_addr *src, struct in6_addr *dst)
182 return container_of(q, struct nf_ct_frag6_queue, q); 182 return container_of(q, struct nf_ct_frag6_queue, q);
183 183
184oom: 184oom:
185 pr_debug("Can't alloc new queue\n");
186 return NULL; 185 return NULL;
187} 186}
188 187
@@ -370,10 +369,10 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
370 struct sk_buff *clone; 369 struct sk_buff *clone;
371 int i, plen = 0; 370 int i, plen = 0;
372 371
373 if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL) { 372 clone = alloc_skb(0, GFP_ATOMIC);
374 pr_debug("Can't alloc skb\n"); 373 if (clone == NULL)
375 goto out_oom; 374 goto out_oom;
376 } 375
377 clone->next = head->next; 376 clone->next = head->next;
378 head->next = clone; 377 head->next = clone;
379 skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list; 378 skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 10b2b3165a1a..36131d122a6f 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -2161,12 +2161,18 @@ out:
2161 return 0; 2161 return 0;
2162} 2162}
2163 2163
2164static const struct file_operations tcp6_afinfo_seq_fops = {
2165 .owner = THIS_MODULE,
2166 .open = tcp_seq_open,
2167 .read = seq_read,
2168 .llseek = seq_lseek,
2169 .release = seq_release_net
2170};
2171
2164static struct tcp_seq_afinfo tcp6_seq_afinfo = { 2172static struct tcp_seq_afinfo tcp6_seq_afinfo = {
2165 .name = "tcp6", 2173 .name = "tcp6",
2166 .family = AF_INET6, 2174 .family = AF_INET6,
2167 .seq_fops = { 2175 .seq_fops = &tcp6_afinfo_seq_fops,
2168 .owner = THIS_MODULE,
2169 },
2170 .seq_ops = { 2176 .seq_ops = {
2171 .show = tcp6_seq_show, 2177 .show = tcp6_seq_show,
2172 }, 2178 },
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index f4ca0a5b3457..846f4757eb8d 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1424,13 +1424,19 @@ int udp6_seq_show(struct seq_file *seq, void *v)
1424 return 0; 1424 return 0;
1425} 1425}
1426 1426
1427static const struct file_operations udp6_afinfo_seq_fops = {
1428 .owner = THIS_MODULE,
1429 .open = udp_seq_open,
1430 .read = seq_read,
1431 .llseek = seq_lseek,
1432 .release = seq_release_net
1433};
1434
1427static struct udp_seq_afinfo udp6_seq_afinfo = { 1435static struct udp_seq_afinfo udp6_seq_afinfo = {
1428 .name = "udp6", 1436 .name = "udp6",
1429 .family = AF_INET6, 1437 .family = AF_INET6,
1430 .udp_table = &udp_table, 1438 .udp_table = &udp_table,
1431 .seq_fops = { 1439 .seq_fops = &udp6_afinfo_seq_fops,
1432 .owner = THIS_MODULE,
1433 },
1434 .seq_ops = { 1440 .seq_ops = {
1435 .show = udp6_seq_show, 1441 .show = udp6_seq_show,
1436 }, 1442 },
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 986c4de5292e..8889aa22ed47 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -93,13 +93,20 @@ void udplitev6_exit(void)
93} 93}
94 94
95#ifdef CONFIG_PROC_FS 95#ifdef CONFIG_PROC_FS
96
97static const struct file_operations udplite6_afinfo_seq_fops = {
98 .owner = THIS_MODULE,
99 .open = udp_seq_open,
100 .read = seq_read,
101 .llseek = seq_lseek,
102 .release = seq_release_net
103};
104
96static struct udp_seq_afinfo udplite6_seq_afinfo = { 105static struct udp_seq_afinfo udplite6_seq_afinfo = {
97 .name = "udplite6", 106 .name = "udplite6",
98 .family = AF_INET6, 107 .family = AF_INET6,
99 .udp_table = &udplite_table, 108 .udp_table = &udplite_table,
100 .seq_fops = { 109 .seq_fops = &udplite6_afinfo_seq_fops,
101 .owner = THIS_MODULE,
102 },
103 .seq_ops = { 110 .seq_ops = {
104 .show = udp6_seq_show, 111 .show = udp6_seq_show,
105 }, 112 },
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 34b2ddeacb67..bf8d50c67931 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -397,6 +397,7 @@ static void l2tp_recv_dequeue(struct l2tp_session *session)
397 * expect to send up next, dequeue it and any other 397 * expect to send up next, dequeue it and any other
398 * in-sequence packets behind it. 398 * in-sequence packets behind it.
399 */ 399 */
400start:
400 spin_lock_bh(&session->reorder_q.lock); 401 spin_lock_bh(&session->reorder_q.lock);
401 skb_queue_walk_safe(&session->reorder_q, skb, tmp) { 402 skb_queue_walk_safe(&session->reorder_q, skb, tmp) {
402 if (time_after(jiffies, L2TP_SKB_CB(skb)->expires)) { 403 if (time_after(jiffies, L2TP_SKB_CB(skb)->expires)) {
@@ -433,7 +434,7 @@ static void l2tp_recv_dequeue(struct l2tp_session *session)
433 */ 434 */
434 spin_unlock_bh(&session->reorder_q.lock); 435 spin_unlock_bh(&session->reorder_q.lock);
435 l2tp_recv_dequeue_skb(session, skb); 436 l2tp_recv_dequeue_skb(session, skb);
436 spin_lock_bh(&session->reorder_q.lock); 437 goto start;
437 } 438 }
438 439
439out: 440out:
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 3346829ea07f..afca6c78948c 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -180,17 +180,16 @@ next_hook:
180 if (ret == 0) 180 if (ret == 0)
181 ret = -EPERM; 181 ret = -EPERM;
182 } else if ((verdict & NF_VERDICT_MASK) == NF_QUEUE) { 182 } else if ((verdict & NF_VERDICT_MASK) == NF_QUEUE) {
183 ret = nf_queue(skb, elem, pf, hook, indev, outdev, okfn, 183 int err = nf_queue(skb, elem, pf, hook, indev, outdev, okfn,
184 verdict >> NF_VERDICT_QBITS); 184 verdict >> NF_VERDICT_QBITS);
185 if (ret < 0) { 185 if (err < 0) {
186 if (ret == -ECANCELED) 186 if (err == -ECANCELED)
187 goto next_hook; 187 goto next_hook;
188 if (ret == -ESRCH && 188 if (err == -ESRCH &&
189 (verdict & NF_VERDICT_FLAG_QUEUE_BYPASS)) 189 (verdict & NF_VERDICT_FLAG_QUEUE_BYPASS))
190 goto next_hook; 190 goto next_hook;
191 kfree_skb(skb); 191 kfree_skb(skb);
192 } 192 }
193 ret = 0;
194 } 193 }
195 rcu_read_unlock(); 194 rcu_read_unlock();
196 return ret; 195 return ret;
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index d7e86ef9d23a..86137b558f45 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -1699,10 +1699,8 @@ ip_set_init(void)
1699 1699
1700 ip_set_list = kzalloc(sizeof(struct ip_set *) * ip_set_max, 1700 ip_set_list = kzalloc(sizeof(struct ip_set *) * ip_set_max,
1701 GFP_KERNEL); 1701 GFP_KERNEL);
1702 if (!ip_set_list) { 1702 if (!ip_set_list)
1703 pr_err("ip_set: Unable to create ip_set_list\n");
1704 return -ENOMEM; 1703 return -ENOMEM;
1705 }
1706 1704
1707 ret = nfnetlink_subsys_register(&ip_set_netlink_subsys); 1705 ret = nfnetlink_subsys_register(&ip_set_netlink_subsys);
1708 if (ret != 0) { 1706 if (ret != 0) {
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 4f77bb16d22a..093cc327020f 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -188,14 +188,13 @@ ip_vs_conn_stats(struct ip_vs_conn *cp, struct ip_vs_service *svc)
188} 188}
189 189
190 190
191static inline int 191static inline void
192ip_vs_set_state(struct ip_vs_conn *cp, int direction, 192ip_vs_set_state(struct ip_vs_conn *cp, int direction,
193 const struct sk_buff *skb, 193 const struct sk_buff *skb,
194 struct ip_vs_proto_data *pd) 194 struct ip_vs_proto_data *pd)
195{ 195{
196 if (unlikely(!pd->pp->state_transition)) 196 if (likely(pd->pp->state_transition))
197 return 0; 197 pd->pp->state_transition(cp, direction, skb, pd);
198 return pd->pp->state_transition(cp, direction, skb, pd);
199} 198}
200 199
201static inline int 200static inline int
@@ -530,7 +529,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
530 a cache_bypass connection entry */ 529 a cache_bypass connection entry */
531 ipvs = net_ipvs(net); 530 ipvs = net_ipvs(net);
532 if (ipvs->sysctl_cache_bypass && svc->fwmark && unicast) { 531 if (ipvs->sysctl_cache_bypass && svc->fwmark && unicast) {
533 int ret, cs; 532 int ret;
534 struct ip_vs_conn *cp; 533 struct ip_vs_conn *cp;
535 unsigned int flags = (svc->flags & IP_VS_SVC_F_ONEPACKET && 534 unsigned int flags = (svc->flags & IP_VS_SVC_F_ONEPACKET &&
536 iph.protocol == IPPROTO_UDP)? 535 iph.protocol == IPPROTO_UDP)?
@@ -557,7 +556,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
557 ip_vs_in_stats(cp, skb); 556 ip_vs_in_stats(cp, skb);
558 557
559 /* set state */ 558 /* set state */
560 cs = ip_vs_set_state(cp, IP_VS_DIR_INPUT, skb, pd); 559 ip_vs_set_state(cp, IP_VS_DIR_INPUT, skb, pd);
561 560
562 /* transmit the first SYN packet */ 561 /* transmit the first SYN packet */
563 ret = cp->packet_xmit(skb, cp, pd->pp); 562 ret = cp->packet_xmit(skb, cp, pd->pp);
@@ -1490,7 +1489,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
1490 struct ip_vs_protocol *pp; 1489 struct ip_vs_protocol *pp;
1491 struct ip_vs_proto_data *pd; 1490 struct ip_vs_proto_data *pd;
1492 struct ip_vs_conn *cp; 1491 struct ip_vs_conn *cp;
1493 int ret, restart, pkts; 1492 int ret, pkts;
1494 struct netns_ipvs *ipvs; 1493 struct netns_ipvs *ipvs;
1495 1494
1496 /* Already marked as IPVS request or reply? */ 1495 /* Already marked as IPVS request or reply? */
@@ -1591,7 +1590,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
1591 } 1590 }
1592 1591
1593 ip_vs_in_stats(cp, skb); 1592 ip_vs_in_stats(cp, skb);
1594 restart = ip_vs_set_state(cp, IP_VS_DIR_INPUT, skb, pd); 1593 ip_vs_set_state(cp, IP_VS_DIR_INPUT, skb, pd);
1595 if (cp->packet_xmit) 1594 if (cp->packet_xmit)
1596 ret = cp->packet_xmit(skb, cp, pp); 1595 ret = cp->packet_xmit(skb, cp, pp);
1597 /* do not touch skb anymore */ 1596 /* do not touch skb anymore */
@@ -1878,10 +1877,9 @@ static int __net_init __ip_vs_init(struct net *net)
1878 struct netns_ipvs *ipvs; 1877 struct netns_ipvs *ipvs;
1879 1878
1880 ipvs = net_generic(net, ip_vs_net_id); 1879 ipvs = net_generic(net, ip_vs_net_id);
1881 if (ipvs == NULL) { 1880 if (ipvs == NULL)
1882 pr_err("%s(): no memory.\n", __func__);
1883 return -ENOMEM; 1881 return -ENOMEM;
1884 } 1882
1885 /* Hold the beast until a service is registerd */ 1883 /* Hold the beast until a service is registerd */
1886 ipvs->enable = 0; 1884 ipvs->enable = 0;
1887 ipvs->net = net; 1885 ipvs->net = net;
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index e3be48bf4dcd..008bf97cc91a 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -856,15 +856,12 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
856 } 856 }
857 857
858 dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL); 858 dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL);
859 if (dest == NULL) { 859 if (dest == NULL)
860 pr_err("%s(): no memory.\n", __func__);
861 return -ENOMEM; 860 return -ENOMEM;
862 } 861
863 dest->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); 862 dest->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
864 if (!dest->stats.cpustats) { 863 if (!dest->stats.cpustats)
865 pr_err("%s() alloc_percpu failed\n", __func__);
866 goto err_alloc; 864 goto err_alloc;
867 }
868 865
869 dest->af = svc->af; 866 dest->af = svc->af;
870 dest->protocol = svc->protocol; 867 dest->protocol = svc->protocol;
@@ -1168,10 +1165,8 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
1168 goto out_err; 1165 goto out_err;
1169 } 1166 }
1170 svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); 1167 svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
1171 if (!svc->stats.cpustats) { 1168 if (!svc->stats.cpustats)
1172 pr_err("%s() alloc_percpu failed\n", __func__);
1173 goto out_err; 1169 goto out_err;
1174 }
1175 1170
1176 /* I'm the first user of the service */ 1171 /* I'm the first user of the service */
1177 atomic_set(&svc->usecnt, 0); 1172 atomic_set(&svc->usecnt, 0);
@@ -3326,10 +3321,8 @@ static int ip_vs_genl_set_cmd(struct sk_buff *skb, struct genl_info *info)
3326 int ret = 0, cmd; 3321 int ret = 0, cmd;
3327 int need_full_svc = 0, need_full_dest = 0; 3322 int need_full_svc = 0, need_full_dest = 0;
3328 struct net *net; 3323 struct net *net;
3329 struct netns_ipvs *ipvs;
3330 3324
3331 net = skb_sknet(skb); 3325 net = skb_sknet(skb);
3332 ipvs = net_ipvs(net);
3333 cmd = info->genlhdr->cmd; 3326 cmd = info->genlhdr->cmd;
3334 3327
3335 mutex_lock(&__ip_vs_mutex); 3328 mutex_lock(&__ip_vs_mutex);
@@ -3421,10 +3414,8 @@ static int ip_vs_genl_get_cmd(struct sk_buff *skb, struct genl_info *info)
3421 void *reply; 3414 void *reply;
3422 int ret, cmd, reply_cmd; 3415 int ret, cmd, reply_cmd;
3423 struct net *net; 3416 struct net *net;
3424 struct netns_ipvs *ipvs;
3425 3417
3426 net = skb_sknet(skb); 3418 net = skb_sknet(skb);
3427 ipvs = net_ipvs(net);
3428 cmd = info->genlhdr->cmd; 3419 cmd = info->genlhdr->cmd;
3429 3420
3430 if (cmd == IPVS_CMD_GET_SERVICE) 3421 if (cmd == IPVS_CMD_GET_SERVICE)
@@ -3720,10 +3711,9 @@ int __net_init ip_vs_control_net_init(struct net *net)
3720 3711
3721 /* procfs stats */ 3712 /* procfs stats */
3722 ipvs->tot_stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); 3713 ipvs->tot_stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
3723 if (!ipvs->tot_stats.cpustats) { 3714 if (!ipvs->tot_stats.cpustats)
3724 pr_err("%s(): alloc_percpu.\n", __func__);
3725 return -ENOMEM; 3715 return -ENOMEM;
3726 } 3716
3727 spin_lock_init(&ipvs->tot_stats.lock); 3717 spin_lock_init(&ipvs->tot_stats.lock);
3728 3718
3729 proc_net_fops_create(net, "ip_vs", 0, &ip_vs_info_fops); 3719 proc_net_fops_create(net, "ip_vs", 0, &ip_vs_info_fops);
diff --git a/net/netfilter/ipvs/ip_vs_dh.c b/net/netfilter/ipvs/ip_vs_dh.c
index 95fd0d14200b..1c269e56200a 100644
--- a/net/netfilter/ipvs/ip_vs_dh.c
+++ b/net/netfilter/ipvs/ip_vs_dh.c
@@ -150,10 +150,9 @@ static int ip_vs_dh_init_svc(struct ip_vs_service *svc)
150 /* allocate the DH table for this service */ 150 /* allocate the DH table for this service */
151 tbl = kmalloc(sizeof(struct ip_vs_dh_bucket)*IP_VS_DH_TAB_SIZE, 151 tbl = kmalloc(sizeof(struct ip_vs_dh_bucket)*IP_VS_DH_TAB_SIZE,
152 GFP_ATOMIC); 152 GFP_ATOMIC);
153 if (tbl == NULL) { 153 if (tbl == NULL)
154 pr_err("%s(): no memory\n", __func__);
155 return -ENOMEM; 154 return -ENOMEM;
156 } 155
157 svc->sched_data = tbl; 156 svc->sched_data = tbl;
158 IP_VS_DBG(6, "DH hash table (memory=%Zdbytes) allocated for " 157 IP_VS_DBG(6, "DH hash table (memory=%Zdbytes) allocated for "
159 "current service\n", 158 "current service\n",
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
index 4490a32ad5b2..538d74ee4f68 100644
--- a/net/netfilter/ipvs/ip_vs_ftp.c
+++ b/net/netfilter/ipvs/ip_vs_ftp.c
@@ -52,8 +52,9 @@
52 * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper 52 * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper
53 * First port is set to the default port. 53 * First port is set to the default port.
54 */ 54 */
55static unsigned int ports_count = 1;
55static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0}; 56static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0};
56module_param_array(ports, ushort, NULL, 0); 57module_param_array(ports, ushort, &ports_count, 0444);
57MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands"); 58MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands");
58 59
59 60
@@ -449,7 +450,7 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
449 if (ret) 450 if (ret)
450 goto err_exit; 451 goto err_exit;
451 452
452 for (i=0; i<IP_VS_APP_MAX_PORTS; i++) { 453 for (i = 0; i < ports_count; i++) {
453 if (!ports[i]) 454 if (!ports[i])
454 continue; 455 continue;
455 ret = register_ip_vs_app_inc(net, app, app->protocol, ports[i]); 456 ret = register_ip_vs_app_inc(net, app, app->protocol, ports[i]);
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c
index 87e40ea77a95..0f16283fd058 100644
--- a/net/netfilter/ipvs/ip_vs_lblc.c
+++ b/net/netfilter/ipvs/ip_vs_lblc.c
@@ -202,10 +202,8 @@ ip_vs_lblc_new(struct ip_vs_lblc_table *tbl, const union nf_inet_addr *daddr,
202 en = ip_vs_lblc_get(dest->af, tbl, daddr); 202 en = ip_vs_lblc_get(dest->af, tbl, daddr);
203 if (!en) { 203 if (!en) {
204 en = kmalloc(sizeof(*en), GFP_ATOMIC); 204 en = kmalloc(sizeof(*en), GFP_ATOMIC);
205 if (!en) { 205 if (!en)
206 pr_err("%s(): no memory\n", __func__);
207 return NULL; 206 return NULL;
208 }
209 207
210 en->af = dest->af; 208 en->af = dest->af;
211 ip_vs_addr_copy(dest->af, &en->addr, daddr); 209 ip_vs_addr_copy(dest->af, &en->addr, daddr);
@@ -345,10 +343,9 @@ static int ip_vs_lblc_init_svc(struct ip_vs_service *svc)
345 * Allocate the ip_vs_lblc_table for this service 343 * Allocate the ip_vs_lblc_table for this service
346 */ 344 */
347 tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC); 345 tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC);
348 if (tbl == NULL) { 346 if (tbl == NULL)
349 pr_err("%s(): no memory\n", __func__);
350 return -ENOMEM; 347 return -ENOMEM;
351 } 348
352 svc->sched_data = tbl; 349 svc->sched_data = tbl;
353 IP_VS_DBG(6, "LBLC hash table (memory=%Zdbytes) allocated for " 350 IP_VS_DBG(6, "LBLC hash table (memory=%Zdbytes) allocated for "
354 "current service\n", sizeof(*tbl)); 351 "current service\n", sizeof(*tbl));
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c
index 90f618ab6dda..eec797f8cce7 100644
--- a/net/netfilter/ipvs/ip_vs_lblcr.c
+++ b/net/netfilter/ipvs/ip_vs_lblcr.c
@@ -112,10 +112,8 @@ ip_vs_dest_set_insert(struct ip_vs_dest_set *set, struct ip_vs_dest *dest)
112 } 112 }
113 113
114 e = kmalloc(sizeof(*e), GFP_ATOMIC); 114 e = kmalloc(sizeof(*e), GFP_ATOMIC);
115 if (e == NULL) { 115 if (e == NULL)
116 pr_err("%s(): no memory\n", __func__);
117 return NULL; 116 return NULL;
118 }
119 117
120 atomic_inc(&dest->refcnt); 118 atomic_inc(&dest->refcnt);
121 e->dest = dest; 119 e->dest = dest;
@@ -373,10 +371,8 @@ ip_vs_lblcr_new(struct ip_vs_lblcr_table *tbl, const union nf_inet_addr *daddr,
373 en = ip_vs_lblcr_get(dest->af, tbl, daddr); 371 en = ip_vs_lblcr_get(dest->af, tbl, daddr);
374 if (!en) { 372 if (!en) {
375 en = kmalloc(sizeof(*en), GFP_ATOMIC); 373 en = kmalloc(sizeof(*en), GFP_ATOMIC);
376 if (!en) { 374 if (!en)
377 pr_err("%s(): no memory\n", __func__);
378 return NULL; 375 return NULL;
379 }
380 376
381 en->af = dest->af; 377 en->af = dest->af;
382 ip_vs_addr_copy(dest->af, &en->addr, daddr); 378 ip_vs_addr_copy(dest->af, &en->addr, daddr);
@@ -516,10 +512,9 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
516 * Allocate the ip_vs_lblcr_table for this service 512 * Allocate the ip_vs_lblcr_table for this service
517 */ 513 */
518 tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC); 514 tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC);
519 if (tbl == NULL) { 515 if (tbl == NULL)
520 pr_err("%s(): no memory\n", __func__);
521 return -ENOMEM; 516 return -ENOMEM;
522 } 517
523 svc->sched_data = tbl; 518 svc->sched_data = tbl;
524 IP_VS_DBG(6, "LBLCR hash table (memory=%Zdbytes) allocated for " 519 IP_VS_DBG(6, "LBLCR hash table (memory=%Zdbytes) allocated for "
525 "current service\n", sizeof(*tbl)); 520 "current service\n", sizeof(*tbl));
diff --git a/net/netfilter/ipvs/ip_vs_nfct.c b/net/netfilter/ipvs/ip_vs_nfct.c
index f454c80df0a7..022e77e1e766 100644
--- a/net/netfilter/ipvs/ip_vs_nfct.c
+++ b/net/netfilter/ipvs/ip_vs_nfct.c
@@ -127,7 +127,7 @@ ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, int outin)
127 nf_conntrack_alter_reply(ct, &new_tuple); 127 nf_conntrack_alter_reply(ct, &new_tuple);
128} 128}
129 129
130int ip_vs_confirm_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp) 130int ip_vs_confirm_conntrack(struct sk_buff *skb)
131{ 131{
132 return nf_conntrack_confirm(skb); 132 return nf_conntrack_confirm(skb);
133} 133}
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c
index 52d073c105e9..85312939695f 100644
--- a/net/netfilter/ipvs/ip_vs_proto.c
+++ b/net/netfilter/ipvs/ip_vs_proto.c
@@ -74,10 +74,9 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp)
74 struct ip_vs_proto_data *pd = 74 struct ip_vs_proto_data *pd =
75 kzalloc(sizeof(struct ip_vs_proto_data), GFP_ATOMIC); 75 kzalloc(sizeof(struct ip_vs_proto_data), GFP_ATOMIC);
76 76
77 if (!pd) { 77 if (!pd)
78 pr_err("%s(): no memory.\n", __func__);
79 return -ENOMEM; 78 return -ENOMEM;
80 } 79
81 pd->pp = pp; /* For speed issues */ 80 pd->pp = pp; /* For speed issues */
82 pd->next = ipvs->proto_data_table[hash]; 81 pd->next = ipvs->proto_data_table[hash];
83 ipvs->proto_data_table[hash] = pd; 82 ipvs->proto_data_table[hash] = pd;
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c
index d12ed53ec95f..1fbf7a2816f5 100644
--- a/net/netfilter/ipvs/ip_vs_proto_sctp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c
@@ -906,7 +906,7 @@ static const char *sctp_state_name(int state)
906 return "?"; 906 return "?";
907} 907}
908 908
909static inline int 909static inline void
910set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, 910set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
911 int direction, const struct sk_buff *skb) 911 int direction, const struct sk_buff *skb)
912{ 912{
@@ -924,7 +924,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
924 sch = skb_header_pointer(skb, ihl + sizeof(sctp_sctphdr_t), 924 sch = skb_header_pointer(skb, ihl + sizeof(sctp_sctphdr_t),
925 sizeof(_sctpch), &_sctpch); 925 sizeof(_sctpch), &_sctpch);
926 if (sch == NULL) 926 if (sch == NULL)
927 return 0; 927 return;
928 928
929 chunk_type = sch->type; 929 chunk_type = sch->type;
930 /* 930 /*
@@ -993,21 +993,15 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
993 cp->timeout = pd->timeout_table[cp->state = next_state]; 993 cp->timeout = pd->timeout_table[cp->state = next_state];
994 else /* What to do ? */ 994 else /* What to do ? */
995 cp->timeout = sctp_timeouts[cp->state = next_state]; 995 cp->timeout = sctp_timeouts[cp->state = next_state];
996
997 return 1;
998} 996}
999 997
1000static int 998static void
1001sctp_state_transition(struct ip_vs_conn *cp, int direction, 999sctp_state_transition(struct ip_vs_conn *cp, int direction,
1002 const struct sk_buff *skb, struct ip_vs_proto_data *pd) 1000 const struct sk_buff *skb, struct ip_vs_proto_data *pd)
1003{ 1001{
1004 int ret = 0;
1005
1006 spin_lock(&cp->lock); 1002 spin_lock(&cp->lock);
1007 ret = set_sctp_state(pd, cp, direction, skb); 1003 set_sctp_state(pd, cp, direction, skb);
1008 spin_unlock(&cp->lock); 1004 spin_unlock(&cp->lock);
1009
1010 return ret;
1011} 1005}
1012 1006
1013static inline __u16 sctp_app_hashkey(__be16 port) 1007static inline __u16 sctp_app_hashkey(__be16 port)
diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c
index c0cc341b840d..ef8641f7af83 100644
--- a/net/netfilter/ipvs/ip_vs_proto_tcp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c
@@ -546,7 +546,7 @@ set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
546/* 546/*
547 * Handle state transitions 547 * Handle state transitions
548 */ 548 */
549static int 549static void
550tcp_state_transition(struct ip_vs_conn *cp, int direction, 550tcp_state_transition(struct ip_vs_conn *cp, int direction,
551 const struct sk_buff *skb, 551 const struct sk_buff *skb,
552 struct ip_vs_proto_data *pd) 552 struct ip_vs_proto_data *pd)
@@ -561,13 +561,11 @@ tcp_state_transition(struct ip_vs_conn *cp, int direction,
561 561
562 th = skb_header_pointer(skb, ihl, sizeof(_tcph), &_tcph); 562 th = skb_header_pointer(skb, ihl, sizeof(_tcph), &_tcph);
563 if (th == NULL) 563 if (th == NULL)
564 return 0; 564 return;
565 565
566 spin_lock(&cp->lock); 566 spin_lock(&cp->lock);
567 set_tcp_state(pd, cp, direction, th); 567 set_tcp_state(pd, cp, direction, th);
568 spin_unlock(&cp->lock); 568 spin_unlock(&cp->lock);
569
570 return 1;
571} 569}
572 570
573static inline __u16 tcp_app_hashkey(__be16 port) 571static inline __u16 tcp_app_hashkey(__be16 port)
diff --git a/net/netfilter/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c
index f1282cbe6fe3..f4b7262896bb 100644
--- a/net/netfilter/ipvs/ip_vs_proto_udp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_udp.c
@@ -454,18 +454,17 @@ static const char * udp_state_name(int state)
454 return udp_state_name_table[state] ? udp_state_name_table[state] : "?"; 454 return udp_state_name_table[state] ? udp_state_name_table[state] : "?";
455} 455}
456 456
457static int 457static void
458udp_state_transition(struct ip_vs_conn *cp, int direction, 458udp_state_transition(struct ip_vs_conn *cp, int direction,
459 const struct sk_buff *skb, 459 const struct sk_buff *skb,
460 struct ip_vs_proto_data *pd) 460 struct ip_vs_proto_data *pd)
461{ 461{
462 if (unlikely(!pd)) { 462 if (unlikely(!pd)) {
463 pr_err("UDP no ns data\n"); 463 pr_err("UDP no ns data\n");
464 return 0; 464 return;
465 } 465 }
466 466
467 cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL]; 467 cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL];
468 return 1;
469} 468}
470 469
471static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) 470static void __udp_init(struct net *net, struct ip_vs_proto_data *pd)
diff --git a/net/netfilter/ipvs/ip_vs_sh.c b/net/netfilter/ipvs/ip_vs_sh.c
index b5e2556c581a..33815f4fb451 100644
--- a/net/netfilter/ipvs/ip_vs_sh.c
+++ b/net/netfilter/ipvs/ip_vs_sh.c
@@ -147,10 +147,9 @@ static int ip_vs_sh_init_svc(struct ip_vs_service *svc)
147 /* allocate the SH table for this service */ 147 /* allocate the SH table for this service */
148 tbl = kmalloc(sizeof(struct ip_vs_sh_bucket)*IP_VS_SH_TAB_SIZE, 148 tbl = kmalloc(sizeof(struct ip_vs_sh_bucket)*IP_VS_SH_TAB_SIZE,
149 GFP_ATOMIC); 149 GFP_ATOMIC);
150 if (tbl == NULL) { 150 if (tbl == NULL)
151 pr_err("%s(): no memory\n", __func__);
152 return -ENOMEM; 151 return -ENOMEM;
153 } 152
154 svc->sched_data = tbl; 153 svc->sched_data = tbl;
155 IP_VS_DBG(6, "SH hash table (memory=%Zdbytes) allocated for " 154 IP_VS_DBG(6, "SH hash table (memory=%Zdbytes) allocated for "
156 "current service\n", 155 "current service\n",
diff --git a/net/netfilter/ipvs/ip_vs_wrr.c b/net/netfilter/ipvs/ip_vs_wrr.c
index 1ef41f50723c..fd0d4e09876a 100644
--- a/net/netfilter/ipvs/ip_vs_wrr.c
+++ b/net/netfilter/ipvs/ip_vs_wrr.c
@@ -85,10 +85,9 @@ static int ip_vs_wrr_init_svc(struct ip_vs_service *svc)
85 * Allocate the mark variable for WRR scheduling 85 * Allocate the mark variable for WRR scheduling
86 */ 86 */
87 mark = kmalloc(sizeof(struct ip_vs_wrr_mark), GFP_ATOMIC); 87 mark = kmalloc(sizeof(struct ip_vs_wrr_mark), GFP_ATOMIC);
88 if (mark == NULL) { 88 if (mark == NULL)
89 pr_err("%s(): no memory\n", __func__);
90 return -ENOMEM; 89 return -ENOMEM;
91 } 90
92 mark->cl = &svc->destinations; 91 mark->cl = &svc->destinations;
93 mark->cw = 0; 92 mark->cw = 0;
94 mark->mw = ip_vs_wrr_max_weight(svc); 93 mark->mw = ip_vs_wrr_max_weight(svc);
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index ee319a4338b0..aa2d7206ee8a 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -339,7 +339,7 @@ ip_vs_dst_reset(struct ip_vs_dest *dest)
339 \ 339 \
340 (skb)->ipvs_property = 1; \ 340 (skb)->ipvs_property = 1; \
341 if (unlikely((cp)->flags & IP_VS_CONN_F_NFCT)) \ 341 if (unlikely((cp)->flags & IP_VS_CONN_F_NFCT)) \
342 __ret = ip_vs_confirm_conntrack(skb, cp); \ 342 __ret = ip_vs_confirm_conntrack(skb); \
343 if (__ret == NF_ACCEPT) { \ 343 if (__ret == NF_ACCEPT) { \
344 nf_reset(skb); \ 344 nf_reset(skb); \
345 skb_forward_csum(skb); \ 345 skb_forward_csum(skb); \
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 5acfaf59a9c3..7202b0631cd6 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -661,7 +661,6 @@ __nf_conntrack_alloc(struct net *net, u16 zone,
661 */ 661 */
662 ct = kmem_cache_alloc(net->ct.nf_conntrack_cachep, gfp); 662 ct = kmem_cache_alloc(net->ct.nf_conntrack_cachep, gfp);
663 if (ct == NULL) { 663 if (ct == NULL) {
664 pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n");
665 atomic_dec(&net->ct.count); 664 atomic_dec(&net->ct.count);
666 return ERR_PTR(-ENOMEM); 665 return ERR_PTR(-ENOMEM);
667 } 666 }
@@ -749,10 +748,8 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
749 748
750 ct = __nf_conntrack_alloc(net, zone, tuple, &repl_tuple, GFP_ATOMIC, 749 ct = __nf_conntrack_alloc(net, zone, tuple, &repl_tuple, GFP_ATOMIC,
751 hash); 750 hash);
752 if (IS_ERR(ct)) { 751 if (IS_ERR(ct))
753 pr_debug("Can't allocate conntrack.\n");
754 return (struct nf_conntrack_tuple_hash *)ct; 752 return (struct nf_conntrack_tuple_hash *)ct;
755 }
756 753
757 if (!l4proto->new(ct, skb, dataoff)) { 754 if (!l4proto->new(ct, skb, dataoff)) {
758 nf_conntrack_free(ct); 755 nf_conntrack_free(ct);
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 2d8158acf6fa..66b2c54c544f 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -307,17 +307,14 @@ nfulnl_alloc_skb(unsigned int inst_size, unsigned int pkt_size)
307 n = max(inst_size, pkt_size); 307 n = max(inst_size, pkt_size);
308 skb = alloc_skb(n, GFP_ATOMIC); 308 skb = alloc_skb(n, GFP_ATOMIC);
309 if (!skb) { 309 if (!skb) {
310 pr_notice("nfnetlink_log: can't alloc whole buffer (%u bytes)\n",
311 inst_size);
312
313 if (n > pkt_size) { 310 if (n > pkt_size) {
314 /* try to allocate only as much as we need for current 311 /* try to allocate only as much as we need for current
315 * packet */ 312 * packet */
316 313
317 skb = alloc_skb(pkt_size, GFP_ATOMIC); 314 skb = alloc_skb(pkt_size, GFP_ATOMIC);
318 if (!skb) 315 if (!skb)
319 pr_err("nfnetlink_log: can't even alloc %u " 316 pr_err("nfnetlink_log: can't even alloc %u bytes\n",
320 "bytes\n", pkt_size); 317 pkt_size);
321 } 318 }
322 } 319 }
323 320
diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c
index 3bdd443aaf15..f407ebc13481 100644
--- a/net/netfilter/xt_IDLETIMER.c
+++ b/net/netfilter/xt_IDLETIMER.c
@@ -122,14 +122,12 @@ static int idletimer_tg_create(struct idletimer_tg_info *info)
122 122
123 info->timer = kmalloc(sizeof(*info->timer), GFP_KERNEL); 123 info->timer = kmalloc(sizeof(*info->timer), GFP_KERNEL);
124 if (!info->timer) { 124 if (!info->timer) {
125 pr_debug("couldn't alloc timer\n");
126 ret = -ENOMEM; 125 ret = -ENOMEM;
127 goto out; 126 goto out;
128 } 127 }
129 128
130 info->timer->attr.attr.name = kstrdup(info->label, GFP_KERNEL); 129 info->timer->attr.attr.name = kstrdup(info->label, GFP_KERNEL);
131 if (!info->timer->attr.attr.name) { 130 if (!info->timer->attr.attr.name) {
132 pr_debug("couldn't alloc attribute name\n");
133 ret = -ENOMEM; 131 ret = -ENOMEM;
134 goto out_free_timer; 132 goto out_free_timer;
135 } 133 }
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 9228ee0dc11a..dfd52bad1523 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -176,10 +176,7 @@ dsthash_alloc_init(struct xt_hashlimit_htable *ht,
176 ent = NULL; 176 ent = NULL;
177 } else 177 } else
178 ent = kmem_cache_alloc(hashlimit_cachep, GFP_ATOMIC); 178 ent = kmem_cache_alloc(hashlimit_cachep, GFP_ATOMIC);
179 if (!ent) { 179 if (ent) {
180 if (net_ratelimit())
181 pr_err("cannot allocate dsthash_ent\n");
182 } else {
183 memcpy(&ent->dst, dst, sizeof(ent->dst)); 180 memcpy(&ent->dst, dst, sizeof(ent->dst));
184 spin_lock_init(&ent->lock); 181 spin_lock_init(&ent->lock);
185 182
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 03bb45adf2fc..82a6f34d39d0 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -335,7 +335,7 @@ struct packet_skb_cb {
335 (((x)->kactive_blk_num < ((x)->knum_blocks-1)) ? \ 335 (((x)->kactive_blk_num < ((x)->knum_blocks-1)) ? \
336 ((x)->kactive_blk_num+1) : 0) 336 ((x)->kactive_blk_num+1) : 0)
337 337
338static inline struct packet_sock *pkt_sk(struct sock *sk) 338static struct packet_sock *pkt_sk(struct sock *sk)
339{ 339{
340 return (struct packet_sock *)sk; 340 return (struct packet_sock *)sk;
341} 341}
@@ -477,7 +477,7 @@ static void *packet_lookup_frame(struct packet_sock *po,
477 return h.raw; 477 return h.raw;
478} 478}
479 479
480static inline void *packet_current_frame(struct packet_sock *po, 480static void *packet_current_frame(struct packet_sock *po,
481 struct packet_ring_buffer *rb, 481 struct packet_ring_buffer *rb,
482 int status) 482 int status)
483{ 483{
@@ -715,7 +715,7 @@ out:
715 spin_unlock(&po->sk.sk_receive_queue.lock); 715 spin_unlock(&po->sk.sk_receive_queue.lock);
716} 716}
717 717
718static inline void prb_flush_block(struct tpacket_kbdq_core *pkc1, 718static void prb_flush_block(struct tpacket_kbdq_core *pkc1,
719 struct tpacket_block_desc *pbd1, __u32 status) 719 struct tpacket_block_desc *pbd1, __u32 status)
720{ 720{
721 /* Flush everything minus the block header */ 721 /* Flush everything minus the block header */
@@ -793,7 +793,7 @@ static void prb_close_block(struct tpacket_kbdq_core *pkc1,
793 pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1); 793 pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1);
794} 794}
795 795
796static inline void prb_thaw_queue(struct tpacket_kbdq_core *pkc) 796static void prb_thaw_queue(struct tpacket_kbdq_core *pkc)
797{ 797{
798 pkc->reset_pending_on_curr_blk = 0; 798 pkc->reset_pending_on_curr_blk = 0;
799} 799}
@@ -869,7 +869,7 @@ static void prb_open_block(struct tpacket_kbdq_core *pkc1,
869 * case and __packet_lookup_frame_in_block will check if block-0 869 * case and __packet_lookup_frame_in_block will check if block-0
870 * is free and can now be re-used. 870 * is free and can now be re-used.
871 */ 871 */
872static inline void prb_freeze_queue(struct tpacket_kbdq_core *pkc, 872static void prb_freeze_queue(struct tpacket_kbdq_core *pkc,
873 struct packet_sock *po) 873 struct packet_sock *po)
874{ 874{
875 pkc->reset_pending_on_curr_blk = 1; 875 pkc->reset_pending_on_curr_blk = 1;
@@ -940,36 +940,36 @@ static void prb_retire_current_block(struct tpacket_kbdq_core *pkc,
940 BUG(); 940 BUG();
941} 941}
942 942
943static inline int prb_curr_blk_in_use(struct tpacket_kbdq_core *pkc, 943static int prb_curr_blk_in_use(struct tpacket_kbdq_core *pkc,
944 struct tpacket_block_desc *pbd) 944 struct tpacket_block_desc *pbd)
945{ 945{
946 return TP_STATUS_USER & BLOCK_STATUS(pbd); 946 return TP_STATUS_USER & BLOCK_STATUS(pbd);
947} 947}
948 948
949static inline int prb_queue_frozen(struct tpacket_kbdq_core *pkc) 949static int prb_queue_frozen(struct tpacket_kbdq_core *pkc)
950{ 950{
951 return pkc->reset_pending_on_curr_blk; 951 return pkc->reset_pending_on_curr_blk;
952} 952}
953 953
954static inline void prb_clear_blk_fill_status(struct packet_ring_buffer *rb) 954static void prb_clear_blk_fill_status(struct packet_ring_buffer *rb)
955{ 955{
956 struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(rb); 956 struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(rb);
957 atomic_dec(&pkc->blk_fill_in_prog); 957 atomic_dec(&pkc->blk_fill_in_prog);
958} 958}
959 959
960static inline void prb_fill_rxhash(struct tpacket_kbdq_core *pkc, 960static void prb_fill_rxhash(struct tpacket_kbdq_core *pkc,
961 struct tpacket3_hdr *ppd) 961 struct tpacket3_hdr *ppd)
962{ 962{
963 ppd->hv1.tp_rxhash = skb_get_rxhash(pkc->skb); 963 ppd->hv1.tp_rxhash = skb_get_rxhash(pkc->skb);
964} 964}
965 965
966static inline void prb_clear_rxhash(struct tpacket_kbdq_core *pkc, 966static void prb_clear_rxhash(struct tpacket_kbdq_core *pkc,
967 struct tpacket3_hdr *ppd) 967 struct tpacket3_hdr *ppd)
968{ 968{
969 ppd->hv1.tp_rxhash = 0; 969 ppd->hv1.tp_rxhash = 0;
970} 970}
971 971
972static inline void prb_fill_vlan_info(struct tpacket_kbdq_core *pkc, 972static void prb_fill_vlan_info(struct tpacket_kbdq_core *pkc,
973 struct tpacket3_hdr *ppd) 973 struct tpacket3_hdr *ppd)
974{ 974{
975 if (vlan_tx_tag_present(pkc->skb)) { 975 if (vlan_tx_tag_present(pkc->skb)) {
@@ -991,7 +991,7 @@ static void prb_run_all_ft_ops(struct tpacket_kbdq_core *pkc,
991 prb_clear_rxhash(pkc, ppd); 991 prb_clear_rxhash(pkc, ppd);
992} 992}
993 993
994static inline void prb_fill_curr_block(char *curr, 994static void prb_fill_curr_block(char *curr,
995 struct tpacket_kbdq_core *pkc, 995 struct tpacket_kbdq_core *pkc,
996 struct tpacket_block_desc *pbd, 996 struct tpacket_block_desc *pbd,
997 unsigned int len) 997 unsigned int len)
@@ -1071,7 +1071,7 @@ static void *__packet_lookup_frame_in_block(struct packet_sock *po,
1071 return NULL; 1071 return NULL;
1072} 1072}
1073 1073
1074static inline void *packet_current_rx_frame(struct packet_sock *po, 1074static void *packet_current_rx_frame(struct packet_sock *po,
1075 struct sk_buff *skb, 1075 struct sk_buff *skb,
1076 int status, unsigned int len) 1076 int status, unsigned int len)
1077{ 1077{
@@ -1091,7 +1091,7 @@ static inline void *packet_current_rx_frame(struct packet_sock *po,
1091 } 1091 }
1092} 1092}
1093 1093
1094static inline void *prb_lookup_block(struct packet_sock *po, 1094static void *prb_lookup_block(struct packet_sock *po,
1095 struct packet_ring_buffer *rb, 1095 struct packet_ring_buffer *rb,
1096 unsigned int previous, 1096 unsigned int previous,
1097 int status) 1097 int status)
@@ -1104,7 +1104,7 @@ static inline void *prb_lookup_block(struct packet_sock *po,
1104 return pbd; 1104 return pbd;
1105} 1105}
1106 1106
1107static inline int prb_previous_blk_num(struct packet_ring_buffer *rb) 1107static int prb_previous_blk_num(struct packet_ring_buffer *rb)
1108{ 1108{
1109 unsigned int prev; 1109 unsigned int prev;
1110 if (rb->prb_bdqc.kactive_blk_num) 1110 if (rb->prb_bdqc.kactive_blk_num)
@@ -1115,7 +1115,7 @@ static inline int prb_previous_blk_num(struct packet_ring_buffer *rb)
1115} 1115}
1116 1116
1117/* Assumes caller has held the rx_queue.lock */ 1117/* Assumes caller has held the rx_queue.lock */
1118static inline void *__prb_previous_block(struct packet_sock *po, 1118static void *__prb_previous_block(struct packet_sock *po,
1119 struct packet_ring_buffer *rb, 1119 struct packet_ring_buffer *rb,
1120 int status) 1120 int status)
1121{ 1121{
@@ -1123,7 +1123,7 @@ static inline void *__prb_previous_block(struct packet_sock *po,
1123 return prb_lookup_block(po, rb, previous, status); 1123 return prb_lookup_block(po, rb, previous, status);
1124} 1124}
1125 1125
1126static inline void *packet_previous_rx_frame(struct packet_sock *po, 1126static void *packet_previous_rx_frame(struct packet_sock *po,
1127 struct packet_ring_buffer *rb, 1127 struct packet_ring_buffer *rb,
1128 int status) 1128 int status)
1129{ 1129{
@@ -1133,7 +1133,7 @@ static inline void *packet_previous_rx_frame(struct packet_sock *po,
1133 return __prb_previous_block(po, rb, status); 1133 return __prb_previous_block(po, rb, status);
1134} 1134}
1135 1135
1136static inline void packet_increment_rx_head(struct packet_sock *po, 1136static void packet_increment_rx_head(struct packet_sock *po,
1137 struct packet_ring_buffer *rb) 1137 struct packet_ring_buffer *rb)
1138{ 1138{
1139 switch (po->tp_version) { 1139 switch (po->tp_version) {
@@ -1148,7 +1148,7 @@ static inline void packet_increment_rx_head(struct packet_sock *po,
1148 } 1148 }
1149} 1149}
1150 1150
1151static inline void *packet_previous_frame(struct packet_sock *po, 1151static void *packet_previous_frame(struct packet_sock *po,
1152 struct packet_ring_buffer *rb, 1152 struct packet_ring_buffer *rb,
1153 int status) 1153 int status)
1154{ 1154{
@@ -1156,7 +1156,7 @@ static inline void *packet_previous_frame(struct packet_sock *po,
1156 return packet_lookup_frame(po, rb, previous, status); 1156 return packet_lookup_frame(po, rb, previous, status);
1157} 1157}
1158 1158
1159static inline void packet_increment_head(struct packet_ring_buffer *buff) 1159static void packet_increment_head(struct packet_ring_buffer *buff)
1160{ 1160{
1161 buff->head = buff->head != buff->frame_max ? buff->head+1 : 0; 1161 buff->head = buff->head != buff->frame_max ? buff->head+1 : 0;
1162} 1162}
@@ -1558,7 +1558,7 @@ out_free:
1558 return err; 1558 return err;
1559} 1559}
1560 1560
1561static inline unsigned int run_filter(const struct sk_buff *skb, 1561static unsigned int run_filter(const struct sk_buff *skb,
1562 const struct sock *sk, 1562 const struct sock *sk,
1563 unsigned int res) 1563 unsigned int res)
1564{ 1564{
@@ -2167,10 +2167,10 @@ out:
2167 return err; 2167 return err;
2168} 2168}
2169 2169
2170static inline struct sk_buff *packet_alloc_skb(struct sock *sk, size_t prepad, 2170static struct sk_buff *packet_alloc_skb(struct sock *sk, size_t prepad,
2171 size_t reserve, size_t len, 2171 size_t reserve, size_t len,
2172 size_t linear, int noblock, 2172 size_t linear, int noblock,
2173 int *err) 2173 int *err)
2174{ 2174{
2175 struct sk_buff *skb; 2175 struct sk_buff *skb;
2176 2176
@@ -3494,7 +3494,7 @@ static void free_pg_vec(struct pgv *pg_vec, unsigned int order,
3494 kfree(pg_vec); 3494 kfree(pg_vec);
3495} 3495}
3496 3496
3497static inline char *alloc_one_pg_vec_page(unsigned long order) 3497static char *alloc_one_pg_vec_page(unsigned long order)
3498{ 3498{
3499 char *buffer = NULL; 3499 char *buffer = NULL;
3500 gfp_t gfp_flags = GFP_KERNEL | __GFP_COMP | 3500 gfp_t gfp_flags = GFP_KERNEL | __GFP_COMP |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 5f03e4ea65bf..3e16c6abde4f 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -1261,14 +1261,19 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
1261 struct x25_sock *x25 = x25_sk(sk); 1261 struct x25_sock *x25 = x25_sk(sk);
1262 struct sockaddr_x25 *sx25 = (struct sockaddr_x25 *)msg->msg_name; 1262 struct sockaddr_x25 *sx25 = (struct sockaddr_x25 *)msg->msg_name;
1263 size_t copied; 1263 size_t copied;
1264 int qbit, header_len = x25->neighbour->extended ? 1264 int qbit, header_len;
1265 X25_EXT_MIN_LEN : X25_STD_MIN_LEN;
1266
1267 struct sk_buff *skb; 1265 struct sk_buff *skb;
1268 unsigned char *asmptr; 1266 unsigned char *asmptr;
1269 int rc = -ENOTCONN; 1267 int rc = -ENOTCONN;
1270 1268
1271 lock_sock(sk); 1269 lock_sock(sk);
1270
1271 if (x25->neighbour == NULL)
1272 goto out;
1273
1274 header_len = x25->neighbour->extended ?
1275 X25_EXT_MIN_LEN : X25_STD_MIN_LEN;
1276
1272 /* 1277 /*
1273 * This works for seqpacket too. The receiver has ordered the queue for 1278 * This works for seqpacket too. The receiver has ordered the queue for
1274 * us! We do one quick check first though 1279 * us! We do one quick check first though