aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_police.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/act_police.c')
-rw-r--r--net/sched/act_police.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 38015b493947..e19a0261144a 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -185,14 +185,21 @@ override:
185 if (parm->peakrate.rate) { 185 if (parm->peakrate.rate) {
186 P_tab = qdisc_get_rtab(&parm->peakrate, 186 P_tab = qdisc_get_rtab(&parm->peakrate,
187 tb[TCA_POLICE_PEAKRATE]); 187 tb[TCA_POLICE_PEAKRATE]);
188 if (P_tab == NULL) { 188 if (P_tab == NULL)
189 qdisc_put_rtab(R_tab);
190 goto failure; 189 goto failure;
191 }
192 } 190 }
193 } 191 }
194 /* No failure allowed after this point */ 192
195 spin_lock_bh(&police->tcf_lock); 193 spin_lock_bh(&police->tcf_lock);
194 if (est) {
195 err = gen_replace_estimator(&police->tcf_bstats,
196 &police->tcf_rate_est,
197 &police->tcf_lock, est);
198 if (err)
199 goto failure_unlock;
200 }
201
202 /* No failure allowed after this point */
196 if (R_tab != NULL) { 203 if (R_tab != NULL) {
197 qdisc_put_rtab(police->tcfp_R_tab); 204 qdisc_put_rtab(police->tcfp_R_tab);
198 police->tcfp_R_tab = R_tab; 205 police->tcfp_R_tab = R_tab;
@@ -217,10 +224,6 @@ override:
217 224
218 if (tb[TCA_POLICE_AVRATE]) 225 if (tb[TCA_POLICE_AVRATE])
219 police->tcfp_ewma_rate = nla_get_u32(tb[TCA_POLICE_AVRATE]); 226 police->tcfp_ewma_rate = nla_get_u32(tb[TCA_POLICE_AVRATE]);
220 if (est)
221 gen_replace_estimator(&police->tcf_bstats,
222 &police->tcf_rate_est,
223 &police->tcf_lock, est);
224 227
225 spin_unlock_bh(&police->tcf_lock); 228 spin_unlock_bh(&police->tcf_lock);
226 if (ret != ACT_P_CREATED) 229 if (ret != ACT_P_CREATED)
@@ -238,7 +241,13 @@ override:
238 a->priv = police; 241 a->priv = police;
239 return ret; 242 return ret;
240 243
244failure_unlock:
245 spin_unlock_bh(&police->tcf_lock);
241failure: 246failure:
247 if (P_tab)
248 qdisc_put_rtab(P_tab);
249 if (R_tab)
250 qdisc_put_rtab(R_tab);
242 if (ret == ACT_P_CREATED) 251 if (ret == ACT_P_CREATED)
243 kfree(police); 252 kfree(police);
244 return err; 253 return err;