This is a note to let you know that I've just added the patch titled

    act_nat: use stack variable

to the 2.6.32-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     act_nat-use-stack-variable.patch
and it can be found in the queue-2.6.32 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 504f85c9d05f7c605306e808f0d835fe11bfd18d Mon Sep 17 00:00:00 2001
From: Changli Gao <[email protected]>
Date: Tue, 29 Jun 2010 23:07:09 +0000
Subject: act_nat: use stack variable

From: Changli Gao <[email protected]>

commit 504f85c9d05f7c605306e808f0d835fe11bfd18d upstream.

act_nat: use stack variable

structure tc_nat isn't too big for stack, so we can put it in stack.

Signed-off-by: Changli Gao <[email protected]>
Cc: dann frazier <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 net/sched/act_nat.c |   33 +++++++++++----------------------
 1 file changed, 11 insertions(+), 22 deletions(-)

--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -261,40 +261,29 @@ static int tcf_nat_dump(struct sk_buff *
 {
        unsigned char *b = skb_tail_pointer(skb);
        struct tcf_nat *p = a->priv;
-       struct tc_nat *opt;
+       struct tc_nat opt;
        struct tcf_t t;
-       int s;
 
-       s = sizeof(*opt);
+       opt.old_addr = p->old_addr;
+       opt.new_addr = p->new_addr;
+       opt.mask = p->mask;
+       opt.flags = p->flags;
+
+       opt.index = p->tcf_index;
+       opt.action = p->tcf_action;
+       opt.refcnt = p->tcf_refcnt - ref;
+       opt.bindcnt = p->tcf_bindcnt - bind;
 
-       /* netlink spinlocks held above us - must use ATOMIC */
-       opt = kzalloc(s, GFP_ATOMIC);
-       if (unlikely(!opt))
-               return -ENOBUFS;
-
-       opt->old_addr = p->old_addr;
-       opt->new_addr = p->new_addr;
-       opt->mask = p->mask;
-       opt->flags = p->flags;
-
-       opt->index = p->tcf_index;
-       opt->action = p->tcf_action;
-       opt->refcnt = p->tcf_refcnt - ref;
-       opt->bindcnt = p->tcf_bindcnt - bind;
-
-       NLA_PUT(skb, TCA_NAT_PARMS, s, opt);
+       NLA_PUT(skb, TCA_NAT_PARMS, sizeof(opt), &opt);
        t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
        t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
        t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
        NLA_PUT(skb, TCA_NAT_TM, sizeof(t), &t);
 
-       kfree(opt);
-
        return skb->len;
 
 nla_put_failure:
        nlmsg_trim(skb, b);
-       kfree(opt);
        return -1;
 }
 


Patches currently in stable-queue which might be from [email protected] are

queue-2.6.32/act_nat-use-stack-variable.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to