aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_fragment.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ip_fragment.c')
-rw-r--r--net/ipv4/ip_fragment.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 575f9bd51ccd..86964b353c31 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -206,10 +206,11 @@ static void ip_expire(unsigned long arg)
206 struct sk_buff *head = qp->q.fragments; 206 struct sk_buff *head = qp->q.fragments;
207 207
208 /* Send an ICMP "Fragment Reassembly Timeout" message. */ 208 /* Send an ICMP "Fragment Reassembly Timeout" message. */
209 if ((head->dev = dev_get_by_index(net, qp->iif)) != NULL) { 209 rcu_read_lock();
210 head->dev = dev_get_by_index_rcu(net, qp->iif);
211 if (head->dev)
210 icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0); 212 icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0);
211 dev_put(head->dev); 213 rcu_read_unlock();
212 }
213 } 214 }
214out: 215out:
215 spin_unlock(&qp->q.lock); 216 spin_unlock(&qp->q.lock);
@@ -563,7 +564,7 @@ out_oversize:
563 printk(KERN_INFO "Oversized IP packet from %pI4.\n", 564 printk(KERN_INFO "Oversized IP packet from %pI4.\n",
564 &qp->saddr); 565 &qp->saddr);
565out_fail: 566out_fail:
566 IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_REASMFAILS); 567 IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS);
567 return err; 568 return err;
568} 569}
569 570
@@ -603,7 +604,6 @@ static int zero;
603 604
604static struct ctl_table ip4_frags_ns_ctl_table[] = { 605static struct ctl_table ip4_frags_ns_ctl_table[] = {
605 { 606 {
606 .ctl_name = NET_IPV4_IPFRAG_HIGH_THRESH,
607 .procname = "ipfrag_high_thresh", 607 .procname = "ipfrag_high_thresh",
608 .data = &init_net.ipv4.frags.high_thresh, 608 .data = &init_net.ipv4.frags.high_thresh,
609 .maxlen = sizeof(int), 609 .maxlen = sizeof(int),
@@ -611,7 +611,6 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = {
611 .proc_handler = proc_dointvec 611 .proc_handler = proc_dointvec
612 }, 612 },
613 { 613 {
614 .ctl_name = NET_IPV4_IPFRAG_LOW_THRESH,
615 .procname = "ipfrag_low_thresh", 614 .procname = "ipfrag_low_thresh",
616 .data = &init_net.ipv4.frags.low_thresh, 615 .data = &init_net.ipv4.frags.low_thresh,
617 .maxlen = sizeof(int), 616 .maxlen = sizeof(int),
@@ -619,26 +618,22 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = {
619 .proc_handler = proc_dointvec 618 .proc_handler = proc_dointvec
620 }, 619 },
621 { 620 {
622 .ctl_name = NET_IPV4_IPFRAG_TIME,
623 .procname = "ipfrag_time", 621 .procname = "ipfrag_time",
624 .data = &init_net.ipv4.frags.timeout, 622 .data = &init_net.ipv4.frags.timeout,
625 .maxlen = sizeof(int), 623 .maxlen = sizeof(int),
626 .mode = 0644, 624 .mode = 0644,
627 .proc_handler = proc_dointvec_jiffies, 625 .proc_handler = proc_dointvec_jiffies,
628 .strategy = sysctl_jiffies
629 }, 626 },
630 { } 627 { }
631}; 628};
632 629
633static struct ctl_table ip4_frags_ctl_table[] = { 630static struct ctl_table ip4_frags_ctl_table[] = {
634 { 631 {
635 .ctl_name = NET_IPV4_IPFRAG_SECRET_INTERVAL,
636 .procname = "ipfrag_secret_interval", 632 .procname = "ipfrag_secret_interval",
637 .data = &ip4_frags.secret_interval, 633 .data = &ip4_frags.secret_interval,
638 .maxlen = sizeof(int), 634 .maxlen = sizeof(int),
639 .mode = 0644, 635 .mode = 0644,
640 .proc_handler = proc_dointvec_jiffies, 636 .proc_handler = proc_dointvec_jiffies,
641 .strategy = sysctl_jiffies
642 }, 637 },
643 { 638 {
644 .procname = "ipfrag_max_dist", 639 .procname = "ipfrag_max_dist",
@@ -657,7 +652,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
657 struct ctl_table_header *hdr; 652 struct ctl_table_header *hdr;
658 653
659 table = ip4_frags_ns_ctl_table; 654 table = ip4_frags_ns_ctl_table;
660 if (net != &init_net) { 655 if (!net_eq(net, &init_net)) {
661 table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL); 656 table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL);
662 if (table == NULL) 657 if (table == NULL)
663 goto err_alloc; 658 goto err_alloc;
@@ -675,7 +670,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
675 return 0; 670 return 0;
676 671
677err_reg: 672err_reg:
678 if (net != &init_net) 673 if (!net_eq(net, &init_net))
679 kfree(table); 674 kfree(table);
680err_alloc: 675err_alloc:
681 return -ENOMEM; 676 return -ENOMEM;