mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
net_sched: properly handle failure case of tcf_exts_init()
After commit 22dc13c837
("net_sched: convert tcf_exts from list to pointer array")
we do dynamic allocation in tcf_exts_init(), therefore we need
to handle the ENOMEM case properly.
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c1346a7e70
commit
b9a24bb76b
11 changed files with 182 additions and 75 deletions
|
@ -69,17 +69,19 @@ struct tcf_exts {
|
|||
int police;
|
||||
};
|
||||
|
||||
static inline void tcf_exts_init(struct tcf_exts *exts, int action, int police)
|
||||
static inline int tcf_exts_init(struct tcf_exts *exts, int action, int police)
|
||||
{
|
||||
#ifdef CONFIG_NET_CLS_ACT
|
||||
exts->type = 0;
|
||||
exts->nr_actions = 0;
|
||||
exts->actions = kcalloc(TCA_ACT_MAX_PRIO, sizeof(struct tc_action *),
|
||||
GFP_KERNEL);
|
||||
WARN_ON(!exts->actions); /* TODO: propagate the error to callers */
|
||||
if (!exts->actions)
|
||||
return -ENOMEM;
|
||||
#endif
|
||||
exts->action = action;
|
||||
exts->police = police;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue