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] [day] [month] [year] [list]
Message-ID: <CAP-5=fU060AZxi6gC7Z4exUqy8VBT08AuE1AZV6F2qDmTKLPwg@mail.gmail.com>
Date:   Fri, 20 Mar 2020 19:24:41 -0700
From:   Ian Rogers <irogers@...gle.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Dan Carpenter <dan.carpenter@...cle.com>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] perf/core: Fix reversed NULL check in perf_event_groups_less()

On Fri, Mar 13, 2020 at 5:27 AM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Thu, Mar 12, 2020 at 01:56:37PM +0300, Dan Carpenter wrote:
> > This NULL check is reversed so it leads to a Smatch warning and
> > presumably a NULL dereference.
> >
> >     kernel/events/core.c:1598 perf_event_groups_less()
> >     error: we previously assumed 'right->cgrp->css.cgroup' could be null
> >       (see line 1590)
> >
> > Fixes: 95ed6c707f26 ("perf/cgroup: Order events in RB tree by cgroup id")
> > Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> > ---
> >  kernel/events/core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index 6a47c3e54fe9..607c04ec7cfa 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -1587,7 +1587,7 @@ perf_event_groups_less(struct perf_event *left, struct perf_event *right)
> >                        */
> >                       return true;
> >               }
> > -             if (!right->cgrp || right->cgrp->css.cgroup) {
> > +             if (!right->cgrp || !right->cgrp->css.cgroup) {
> >                       /*
> >                        * Right has no cgroup but left does, no cgroups come
> >                        * first.
>
> Thanks!

Also much thanks!

Ian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ