lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM0EoMkrTANy8gkohy1wCnP5CKEWuec816DmpdV4LzF88jG7sQ@mail.gmail.com>
Date:   Thu, 23 Feb 2023 10:44:21 -0500
From:   Jamal Hadi Salim <jhs@...atatu.com>
To:     Pedro Tammela <pctammela@...atatu.com>
Cc:     netdev@...r.kernel.org, xiyou.wangcong@...il.com, jiri@...nulli.us,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, error27@...il.com
Subject: Re: [PATCH net] net/sched: act_connmark: handle errno on tcf_idr_check_alloc

On Thu, Feb 23, 2023 at 9:17 AM Pedro Tammela <pctammela@...atatu.com> wrote:
>
> 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")
> Signed-off-by: Pedro Tammela <pctammela@...atatu.com>

Reviewed-by: Jamal Hadi Salim <jhs@...atatu.com>

cheers,
jamal

> ---
>  net/sched/act_connmark.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c
> index 8dabfb52ea3d..cf4086a9e3c0 100644
> --- a/net/sched/act_connmark.c
> +++ b/net/sched/act_connmark.c
> @@ -125,6 +125,7 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
>         if (!nparms)
>                 return -ENOMEM;
>
> +       ci = to_connmark(*a);
>         parm = nla_data(tb[TCA_CONNMARK_PARMS]);
>         index = parm->index;
>         ret = tcf_idr_check_alloc(tn, &index, a, bind);
> @@ -137,14 +138,11 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
>                         goto out_free;
>                 }
>
> -               ci = to_connmark(*a);
> -
>                 nparms->net = net;
>                 nparms->zone = parm->zone;
>
>                 ret = ACT_P_CREATED;
>         } else if (ret > 0) {
> -               ci = to_connmark(*a);
>                 if (bind) {
>                         err = 0;
>                         goto out_free;
> @@ -158,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);
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ