diff options
Diffstat (limited to 'net/sched/act_api.c')
-rw-r--r-- | net/sched/act_api.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 8f457f1e0acf..9d03cc33b6cc 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -214,12 +214,14 @@ struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, int bind, | |||
214 | } | 214 | } |
215 | EXPORT_SYMBOL(tcf_hash_check); | 215 | EXPORT_SYMBOL(tcf_hash_check); |
216 | 216 | ||
217 | struct tcf_common *tcf_hash_create(u32 index, struct nlattr *est, struct tc_action *a, int size, int bind, u32 *idx_gen, struct tcf_hashinfo *hinfo) | 217 | struct tcf_common *tcf_hash_create(u32 index, struct nlattr *est, |
218 | struct tc_action *a, int size, int bind, | ||
219 | u32 *idx_gen, struct tcf_hashinfo *hinfo) | ||
218 | { | 220 | { |
219 | struct tcf_common *p = kzalloc(size, GFP_KERNEL); | 221 | struct tcf_common *p = kzalloc(size, GFP_KERNEL); |
220 | 222 | ||
221 | if (unlikely(!p)) | 223 | if (unlikely(!p)) |
222 | return p; | 224 | return ERR_PTR(-ENOMEM); |
223 | p->tcfc_refcnt = 1; | 225 | p->tcfc_refcnt = 1; |
224 | if (bind) | 226 | if (bind) |
225 | p->tcfc_bindcnt = 1; | 227 | p->tcfc_bindcnt = 1; |
@@ -228,9 +230,15 @@ struct tcf_common *tcf_hash_create(u32 index, struct nlattr *est, struct tc_acti | |||
228 | p->tcfc_index = index ? index : tcf_hash_new_index(idx_gen, hinfo); | 230 | p->tcfc_index = index ? index : tcf_hash_new_index(idx_gen, hinfo); |
229 | p->tcfc_tm.install = jiffies; | 231 | p->tcfc_tm.install = jiffies; |
230 | p->tcfc_tm.lastuse = jiffies; | 232 | p->tcfc_tm.lastuse = jiffies; |
231 | if (est) | 233 | if (est) { |
232 | gen_new_estimator(&p->tcfc_bstats, &p->tcfc_rate_est, | 234 | int err = gen_new_estimator(&p->tcfc_bstats, &p->tcfc_rate_est, |
233 | &p->tcfc_lock, est); | 235 | &p->tcfc_lock, est); |
236 | if (err) { | ||
237 | kfree(p); | ||
238 | return ERR_PTR(err); | ||
239 | } | ||
240 | } | ||
241 | |||
234 | a->priv = (void *) p; | 242 | a->priv = (void *) p; |
235 | return p; | 243 | return p; |
236 | } | 244 | } |