aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamal Hadi Salim <hadi@cyberus.ca>2008-05-06 00:10:24 -0700
committerDavid S. Miller <davem@davemloft.net>2008-05-06 00:10:24 -0700
commit9d1045ad68fcccfaf1393cc463ab6357693e8d1d (patch)
treed34347a568ab3723022350dd6e11ec73a41f380b
parent1da5ea1a8bf4ddb82831528223c853821cb1c9ab (diff)
downloadkernel_samsung_aries-9d1045ad68fcccfaf1393cc463ab6357693e8d1d.zip
kernel_samsung_aries-9d1045ad68fcccfaf1393cc463ab6357693e8d1d.tar.gz
kernel_samsung_aries-9d1045ad68fcccfaf1393cc463ab6357693e8d1d.tar.bz2
net_cls_act: act_simple dont ignore realloc code
reallocation of the policy data was being ignored. It could fail. Simplify so that there is no need for reallocating. Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/act_simple.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index 269ab51..1d421d0 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -79,10 +79,14 @@ static int alloc_defdata(struct tcf_defact *d, char *defdata)
return 0;
}
-static int realloc_defdata(struct tcf_defact *d, char *defdata)
+static void reset_policy(struct tcf_defact *d, char *defdata,
+ struct tc_defact *p)
{
- kfree(d->tcfd_defdata);
- return alloc_defdata(d, defdata);
+ spin_lock_bh(&d->tcf_lock);
+ d->tcf_action = p->action;
+ memset(d->tcfd_defdata, 0, SIMP_MAX_DATA);
+ strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
+ spin_unlock_bh(&d->tcf_lock);
}
static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = {
@@ -129,6 +133,7 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est,
kfree(pc);
return ret;
}
+ d->tcf_action = parm->action;
ret = ACT_P_CREATED;
} else {
d = to_defact(pc);
@@ -136,13 +141,9 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est,
tcf_simp_release(d, bind);
return -EEXIST;
}
- realloc_defdata(d, defdata);
+ reset_policy(d, defdata, parm);
}
- spin_lock_bh(&d->tcf_lock);
- d->tcf_action = parm->action;
- spin_unlock_bh(&d->tcf_lock);
-
if (ret == ACT_P_CREATED)
tcf_hash_insert(pc, &simp_hash_info);
return ret;