diff options
Diffstat (limited to 'net/ipv6/reassembly.c')
| -rw-r--r-- | net/ipv6/reassembly.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 2cddea3bd6be..6d4292ff5854 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #include <linux/random.h> | 41 | #include <linux/random.h> |
| 42 | #include <linux/jhash.h> | 42 | #include <linux/jhash.h> |
| 43 | #include <linux/skbuff.h> | 43 | #include <linux/skbuff.h> |
| 44 | #include <linux/slab.h> | ||
| 44 | 45 | ||
| 45 | #include <net/sock.h> | 46 | #include <net/sock.h> |
| 46 | #include <net/snmp.h> | 47 | #include <net/snmp.h> |
| @@ -228,7 +229,7 @@ static void ip6_frag_expire(unsigned long data) | |||
| 228 | pointer directly, device might already disappeared. | 229 | pointer directly, device might already disappeared. |
| 229 | */ | 230 | */ |
| 230 | fq->q.fragments->dev = dev; | 231 | fq->q.fragments->dev = dev; |
| 231 | icmpv6_send(fq->q.fragments, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0, dev); | 232 | icmpv6_send(fq->q.fragments, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0); |
| 232 | out_rcu_unlock: | 233 | out_rcu_unlock: |
| 233 | rcu_read_unlock(); | 234 | rcu_read_unlock(); |
| 234 | out: | 235 | out: |
| @@ -237,8 +238,7 @@ out: | |||
| 237 | } | 238 | } |
| 238 | 239 | ||
| 239 | static __inline__ struct frag_queue * | 240 | static __inline__ struct frag_queue * |
| 240 | fq_find(struct net *net, __be32 id, struct in6_addr *src, struct in6_addr *dst, | 241 | fq_find(struct net *net, __be32 id, struct in6_addr *src, struct in6_addr *dst) |
| 241 | struct inet6_dev *idev) | ||
| 242 | { | 242 | { |
| 243 | struct inet_frag_queue *q; | 243 | struct inet_frag_queue *q; |
| 244 | struct ip6_create_arg arg; | 244 | struct ip6_create_arg arg; |
| @@ -254,13 +254,9 @@ fq_find(struct net *net, __be32 id, struct in6_addr *src, struct in6_addr *dst, | |||
| 254 | 254 | ||
| 255 | q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash); | 255 | q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash); |
| 256 | if (q == NULL) | 256 | if (q == NULL) |
| 257 | goto oom; | 257 | return NULL; |
| 258 | 258 | ||
| 259 | return container_of(q, struct frag_queue, q); | 259 | return container_of(q, struct frag_queue, q); |
| 260 | |||
| 261 | oom: | ||
| 262 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_REASMFAILS); | ||
| 263 | return NULL; | ||
| 264 | } | 260 | } |
| 265 | 261 | ||
| 266 | static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, | 262 | static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, |
| @@ -606,8 +602,8 @@ static int ipv6_frag_rcv(struct sk_buff *skb) | |||
| 606 | if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh) | 602 | if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh) |
| 607 | ip6_evictor(net, ip6_dst_idev(skb_dst(skb))); | 603 | ip6_evictor(net, ip6_dst_idev(skb_dst(skb))); |
| 608 | 604 | ||
| 609 | if ((fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr, | 605 | fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr); |
| 610 | ip6_dst_idev(skb_dst(skb)))) != NULL) { | 606 | if (fq != NULL) { |
| 611 | int ret; | 607 | int ret; |
| 612 | 608 | ||
| 613 | spin_lock(&fq->q.lock); | 609 | spin_lock(&fq->q.lock); |
| @@ -672,7 +668,7 @@ static struct ctl_table ip6_frags_ctl_table[] = { | |||
| 672 | { } | 668 | { } |
| 673 | }; | 669 | }; |
| 674 | 670 | ||
| 675 | static int ip6_frags_ns_sysctl_register(struct net *net) | 671 | static int __net_init ip6_frags_ns_sysctl_register(struct net *net) |
| 676 | { | 672 | { |
| 677 | struct ctl_table *table; | 673 | struct ctl_table *table; |
| 678 | struct ctl_table_header *hdr; | 674 | struct ctl_table_header *hdr; |
| @@ -702,7 +698,7 @@ err_alloc: | |||
| 702 | return -ENOMEM; | 698 | return -ENOMEM; |
| 703 | } | 699 | } |
| 704 | 700 | ||
| 705 | static void ip6_frags_ns_sysctl_unregister(struct net *net) | 701 | static void __net_exit ip6_frags_ns_sysctl_unregister(struct net *net) |
| 706 | { | 702 | { |
| 707 | struct ctl_table *table; | 703 | struct ctl_table *table; |
| 708 | 704 | ||
| @@ -745,10 +741,10 @@ static inline void ip6_frags_sysctl_unregister(void) | |||
| 745 | } | 741 | } |
| 746 | #endif | 742 | #endif |
| 747 | 743 | ||
| 748 | static int ipv6_frags_init_net(struct net *net) | 744 | static int __net_init ipv6_frags_init_net(struct net *net) |
| 749 | { | 745 | { |
| 750 | net->ipv6.frags.high_thresh = 256 * 1024; | 746 | net->ipv6.frags.high_thresh = IPV6_FRAG_HIGH_THRESH; |
| 751 | net->ipv6.frags.low_thresh = 192 * 1024; | 747 | net->ipv6.frags.low_thresh = IPV6_FRAG_LOW_THRESH; |
| 752 | net->ipv6.frags.timeout = IPV6_FRAG_TIMEOUT; | 748 | net->ipv6.frags.timeout = IPV6_FRAG_TIMEOUT; |
| 753 | 749 | ||
| 754 | inet_frags_init_net(&net->ipv6.frags); | 750 | inet_frags_init_net(&net->ipv6.frags); |
| @@ -756,7 +752,7 @@ static int ipv6_frags_init_net(struct net *net) | |||
| 756 | return ip6_frags_ns_sysctl_register(net); | 752 | return ip6_frags_ns_sysctl_register(net); |
| 757 | } | 753 | } |
| 758 | 754 | ||
| 759 | static void ipv6_frags_exit_net(struct net *net) | 755 | static void __net_exit ipv6_frags_exit_net(struct net *net) |
| 760 | { | 756 | { |
| 761 | ip6_frags_ns_sysctl_unregister(net); | 757 | ip6_frags_ns_sysctl_unregister(net); |
| 762 | inet_frags_exit_net(&net->ipv6.frags, &ip6_frags); | 758 | inet_frags_exit_net(&net->ipv6.frags, &ip6_frags); |
