From: Peter Zijlstra <peterz@infradead.org>
To: Khaled Romdhani <khaledromdhani216@gmail.com>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
bristot@redhat.com, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH-next] sched: Fix Null pointer derefrence
Date: Sun, 16 May 2021 17:37:28 +0200 [thread overview]
Message-ID: <YKE8OHsq4IHN9q8W@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20210516130129.GA32445@ard0534>
On Sun, May 16, 2021 at 02:01:29PM +0100, Khaled Romdhani wrote:
> On Sat, May 15, 2021 at 11:02:38PM +0200, Peter Zijlstra wrote:
> > On Sat, May 15, 2021 at 05:46:45PM +0100, Khaled ROMDHANI wrote:
> > > The 'curr' variable could be NULL and derefrenced by
> > > pick_next_entity. Fix this by adding a check that prevent
> > > the invocation of pick_next_entity with a NULL passed argument.
> >
> > And why exactly is that a problem?
> >
> Within pick_next_entity, we could have 'left = curr'.
> Thus the function wakeup_preempt_entity which is invoked
> from pick_next_entity, derefrence the the sched entity 'left'
> that may be a NULL passed argument.
We call pick_next_entity() from pick_task_fair() (or
pick_next_task_fair(), same argument for both), we only call it when
cfs_rq->nr_running != 0. IOW we *know* there is at least one task.
Therefore, if curr == NULL, we *must* have left.
If you can't read code, stay away from Coverity, it's crap.
prev parent reply other threads:[~2021-05-16 15:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 16:46 [PATCH-next] sched: Fix Null pointer derefrence Khaled ROMDHANI
2021-05-15 21:02 ` Peter Zijlstra
2021-05-16 13:01 ` Khaled Romdhani
2021-05-16 15:37 ` Peter Zijlstra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YKE8OHsq4IHN9q8W@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=khaledromdhani216@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).