- patches.suse/slab-handle-memoryless-nodes-v2a.patch: Refresh.
[linux-flexiantxendom0-3.2.10.git] / net / ipv4 / ip_fragment.c
index 3b7b352..03756d0 100644 (file)
@@ -208,10 +208,11 @@ static void ip_expire(unsigned long arg)
                struct sk_buff *head = qp->q.fragments;
 
                /* Send an ICMP "Fragment Reassembly Timeout" message. */
-               if ((head->dev = dev_get_by_index(net, qp->iif)) != NULL) {
+               rcu_read_lock();
+               head->dev = dev_get_by_index_rcu(net, qp->iif);
+               if (head->dev)
                        icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0);
-                       dev_put(head->dev);
-               }
+               rcu_read_unlock();
        }
 out:
        spin_unlock(&qp->q.lock);
@@ -629,49 +630,17 @@ proc_dointvec_fragment(struct ctl_table *table, int write,
        return ret;
 }
 
-static int sysctl_intvec_fragment(struct ctl_table *table,
-               void __user *oldval, size_t __user *oldlenp,
-               void __user *newval, size_t newlen)
-{
-       struct net *net = container_of(table->data, struct net,
-                                      ipv4.frags.high_thresh);
-       int write = (newval && newlen);
-       ctl_table tmp = *table;
-       int new_bytes, ret;
-
-       mutex_lock(&net->ipv4.frags.lock);
-       if (write) {
-               tmp.data = &new_bytes;
-               table = &tmp;
-       }
-
-       ret = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
-
-       if (!ret && write) {
-               ret = mem_reserve_kmalloc_set(&net->ipv4.frags.reserve,
-                               new_bytes);
-               if (!ret)
-                       net->ipv4.frags.high_thresh = new_bytes;
-       }
-       mutex_unlock(&net->ipv4.frags.lock);
-
-       return ret;
-}
-
 static int zero;
 
 static struct ctl_table ip4_frags_ns_ctl_table[] = {
        {
-               .ctl_name       = NET_IPV4_IPFRAG_HIGH_THRESH,
                .procname       = "ipfrag_high_thresh",
                .data           = &init_net.ipv4.frags.high_thresh,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_fragment,
-               .strategy       = &sysctl_intvec_fragment,
+               .proc_handler   = proc_dointvec_fragment,
        },
        {
-               .ctl_name       = NET_IPV4_IPFRAG_LOW_THRESH,
                .procname       = "ipfrag_low_thresh",
                .data           = &init_net.ipv4.frags.low_thresh,
                .maxlen         = sizeof(int),
@@ -679,26 +648,22 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = {
                .proc_handler   = proc_dointvec
        },
        {
-               .ctl_name       = NET_IPV4_IPFRAG_TIME,
                .procname       = "ipfrag_time",
                .data           = &init_net.ipv4.frags.timeout,
                .maxlen         = sizeof(int),
                .mode           = 0644,
                .proc_handler   = proc_dointvec_jiffies,
-               .strategy       = sysctl_jiffies
        },
        { }
 };
 
 static struct ctl_table ip4_frags_ctl_table[] = {
        {
-               .ctl_name       = NET_IPV4_IPFRAG_SECRET_INTERVAL,
                .procname       = "ipfrag_secret_interval",
                .data           = &ip4_frags.secret_interval,
                .maxlen         = sizeof(int),
                .mode           = 0644,
                .proc_handler   = proc_dointvec_jiffies,
-               .strategy       = sysctl_jiffies
        },
        {
                .procname       = "ipfrag_max_dist",
@@ -717,7 +682,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
        struct ctl_table_header *hdr;
 
        table = ip4_frags_ns_ctl_table;
-       if (net != &init_net) {
+       if (!net_eq(net, &init_net)) {
                table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL);
                if (table == NULL)
                        goto err_alloc;
@@ -735,7 +700,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
        return 0;
 
 err_reg:
-       if (net != &init_net)
+       if (!net_eq(net, &init_net))
                kfree(table);
 err_alloc:
        return -ENOMEM;