aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/act_simple.c')
-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 269ab51cd9b2..1d421d059caf 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)
79 return 0; 79 return 0;
80} 80}
81 81
82static int realloc_defdata(struct tcf_defact *d, char *defdata) 82static void reset_policy(struct tcf_defact *d, char *defdata,
83 struct tc_defact *p)
83{ 84{
84 kfree(d->tcfd_defdata); 85 spin_lock_bh(&d->tcf_lock);
85 return alloc_defdata(d, defdata); 86 d->tcf_action = p->action;
87 memset(d->tcfd_defdata, 0, SIMP_MAX_DATA);
88 strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
89 spin_unlock_bh(&d->tcf_lock);
86} 90}
87 91
88static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = { 92static 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,
129 kfree(pc); 133 kfree(pc);
130 return ret; 134 return ret;
131 } 135 }
136 d->tcf_action = parm->action;
132 ret = ACT_P_CREATED; 137 ret = ACT_P_CREATED;
133 } else { 138 } else {
134 d = to_defact(pc); 139 d = to_defact(pc);
@@ -136,13 +141,9 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est,
136 tcf_simp_release(d, bind); 141 tcf_simp_release(d, bind);
137 return -EEXIST; 142 return -EEXIST;
138 } 143 }
139 realloc_defdata(d, defdata); 144 reset_policy(d, defdata, parm);
140 } 145 }
141 146
142 spin_lock_bh(&d->tcf_lock);
143 d->tcf_action = parm->action;
144 spin_unlock_bh(&d->tcf_lock);
145
146 if (ret == ACT_P_CREATED) 147 if (ret == ACT_P_CREATED)
147 tcf_hash_insert(pc, &simp_hash_info); 148 tcf_hash_insert(pc, &simp_hash_info);
148 return ret; 149 return ret;