]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net/sched: act_connmark: handle errno on tcf_idr_check_alloc
authorPedro Tammela <pctammela@mojatatu.com>
Mon, 27 Feb 2023 15:23:52 +0000 (12:23 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Dec 2025 21:12:36 +0000 (06:12 +0900)
commit fb07390463c95e6eef254044d6dde050bfb9807a upstream.

Smatch reports that 'ci' can be used uninitialized.
The current code ignores errno coming from tcf_idr_check_alloc, which
will lead to the incorrect usage of 'ci'. Handle the errno as it should.

Fixes: 288864effe33 ("net/sched: act_connmark: transition to percpu stats and rcu")
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/act_connmark.c

index 4d75d2ae0d8ce9b2e5db1c2564161d63e052874a..bde78c2ec399ce351211249dee7c612be4bc3519 100644 (file)
@@ -156,6 +156,9 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
                nparms->zone = parm->zone;
 
                ret = 0;
+       } else {
+               err = ret;
+               goto out_free;
        }
 
        err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);