diff options
author | Pedro Tammela <pctammela@mojatatu.com> | 2023-12-01 20:50:14 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-12-05 13:15:08 +0300 |
commit | e09ac779f736e75eab501b77f2a4f13d245f0a6d (patch) | |
tree | 58407275374a5aed9f43624aa784968115ffc24f | |
parent | a0e947c9ccffe47d45aca793d9e7fe4f4494e381 (diff) | |
download | linux-e09ac779f736e75eab501b77f2a4f13d245f0a6d.tar.xz |
net/sched: act_api: stop loop over ops array on NULL in tcf_action_init
The ops array is contiguous, so stop processing whenever a NULL is found
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r-- | net/sched/act_api.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 2e948e5992b6..d3cb9f5b25da 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -1506,10 +1506,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, err: tcf_action_destroy(actions, flags & TCA_ACT_FLAGS_BIND); err_mod: - for (i = 0; i < TCA_ACT_MAX_PRIO; i++) { - if (ops[i]) - module_put(ops[i]->owner); - } + for (i = 0; i < TCA_ACT_MAX_PRIO && ops[i]; i++) + module_put(ops[i]->owner); return err; } |