aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_pedit.c
diff options
context:
space:
mode:
authorJamal Hadi Salim <jhs@mojatatu.com>2013-12-23 08:02:11 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-27 12:50:00 -0500
commit1a29321ed045e3aad23c5f7b63036e465ee3093a (patch)
tree8d59b477b4b3fd575dcf33450cfbc7d5e9c3502b /net/sched/act_pedit.c
parentc2349758acf1874e4c2b93fe41d072336f1a31d0 (diff)
net_sched: act: Dont increment refcnt on replace
This is a bug fix. The existing code tries to kill many birds with one stone: Handling binding of actions to filters, new actions and replacing of action attributes. A simple test case to illustrate: XXXX moja@fe1:~$ sudo tc actions add action drop index 12 moja@fe1:~$ actions get action gact index 12 action order 1: gact action drop random type none pass val 0 index 12 ref 1 bind 0 moja@fe1:~$ sudo tc actions replace action ok index 12 moja@fe1:~$ actions get action gact index 12 action order 1: gact action drop random type none pass val 0 index 12 ref 2 bind 0 XXXX The above shows the refcounf being wrongly incremented on replace. There are more complex scenarios with binding of actions to filters that i am leaving out that didnt work as well... Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_pedit.c')
-rw-r--r--net/sched/act_pedit.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 03b67674169c..7aa2dcd989f8 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -84,10 +84,12 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
84 ret = ACT_P_CREATED; 84 ret = ACT_P_CREATED;
85 } else { 85 } else {
86 p = to_pedit(pc); 86 p = to_pedit(pc);
87 if (!ovr) { 87 tcf_hash_release(pc, bind, &pedit_hash_info);
88 tcf_hash_release(pc, bind, &pedit_hash_info); 88 if (bind)
89 return 0;
90 if (!ovr)
89 return -EEXIST; 91 return -EEXIST;
90 } 92
91 if (p->tcfp_nkeys && p->tcfp_nkeys != parm->nkeys) { 93 if (p->tcfp_nkeys && p->tcfp_nkeys != parm->nkeys) {
92 keys = kmalloc(ksize, GFP_KERNEL); 94 keys = kmalloc(ksize, GFP_KERNEL);
93 if (keys == NULL) 95 if (keys == NULL)