diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-11-26 08:12:32 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-26 08:13:25 +0300 |
commit | 0e991ec6a0340916d3f29bd5dcb35299069e7226 (patch) | |
tree | f8353915d1100b780e057a52f5be84102454af85 /net/sched/act_api.c | |
parent | 4ef8e768335637749af8d83327b174be0ea798a2 (diff) | |
download | linux-0e991ec6a0340916d3f29bd5dcb35299069e7226.tar.xz |
tc: propogate errors from tcf_hash_create
Allow tcf_hash_create to return different errors on estimator failure.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
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, } EXPORT_SYMBOL(tcf_hash_check); -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) +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) { struct tcf_common *p = kzalloc(size, GFP_KERNEL); if (unlikely(!p)) - return p; + return ERR_PTR(-ENOMEM); p->tcfc_refcnt = 1; if (bind) p->tcfc_bindcnt = 1; @@ -228,9 +230,15 @@ struct tcf_common *tcf_hash_create(u32 index, struct nlattr *est, struct tc_acti p->tcfc_index = index ? index : tcf_hash_new_index(idx_gen, hinfo); p->tcfc_tm.install = jiffies; p->tcfc_tm.lastuse = jiffies; - if (est) - gen_new_estimator(&p->tcfc_bstats, &p->tcfc_rate_est, - &p->tcfc_lock, est); + if (est) { + int err = gen_new_estimator(&p->tcfc_bstats, &p->tcfc_rate_est, + &p->tcfc_lock, est); + if (err) { + kfree(p); + return ERR_PTR(err); + } + } + a->priv = (void *) p; return p; } |