public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: Pat Cody <pat@patcody.io>, mingo@redhat.com
Cc: peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, linux-kernel@vger.kernel.org,
	riel@surriel.com, patcody@meta.com, kernel-team@meta.com,
	stable@vger.kernel.org
Subject: Re: [PATCH] sched/fair: Add null pointer check to pick_next_entity()
Date: Thu, 20 Mar 2025 22:42:44 +0000	[thread overview]
Message-ID: <72cb8df7-42e7-4266-b014-7d43796b14d8@arm.com> (raw)
In-Reply-To: <20250320205310.779888-1-pat@patcody.io>

On 3/20/25 20:53, Pat Cody wrote:
> pick_eevdf() can return null, resulting in a null pointer dereference
> crash in pick_next_entity()
> 
> The other call site of pick_eevdf() can already handle a null pointer,
> and pick_next_entity() can already return null as well. Add an extra
> check to handle the null return here.
> 
> Cc: stable@vger.kernel.org
> Fixes: f12e148892ed ("sched/fair: Prepare pick_next_task() for delayed dequeue")
> Signed-off-by: Pat Cody <pat@patcody.io>

Did this happen on mainline? Any chance it's reproducible?

> ---
>  kernel/sched/fair.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index a553181dc764..f2157298cbce 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5560,6 +5560,8 @@ pick_next_entity(struct rq *rq, struct cfs_rq *cfs_rq)
>  	}
>  
>  	struct sched_entity *se = pick_eevdf(cfs_rq);
> +	if (!se)
> +		return NULL;
>  	if (se->sched_delayed) {
>  		dequeue_entities(rq, se, DEQUEUE_SLEEP | DEQUEUE_DELAYED);
>  		/*


  reply	other threads:[~2025-03-20 22:42 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-20 20:53 [PATCH] sched/fair: Add null pointer check to pick_next_entity() Pat Cody
2025-03-20 22:42 ` Christian Loehle [this message]
2025-03-21 17:52   ` Pat Cody
2025-03-24 11:56 ` Peter Zijlstra
2025-03-25 15:12   ` Pat Cody
2025-03-25 18:59     ` Peter Zijlstra
2025-03-26 19:26       ` Pat Cody
2025-04-02 14:59   ` Rik van Riel
2025-04-02 18:07     ` Peter Zijlstra
2025-04-09 14:29       ` Rik van Riel
2025-04-09 15:27         ` Peter Zijlstra
2025-04-11 14:51           ` Rik van Riel
2025-04-14  9:08             ` Peter Zijlstra
2025-04-14 15:38               ` Chris Mason
2025-04-15 10:07                 ` Peter Zijlstra
2025-04-16  7:59                   ` Peter Zijlstra
     [not found]   ` <7B2CFC16-1ADE-4565-B555-7525A50494C2@surriel.com>
     [not found]     ` <20250402082221.GT5880@noisy.programming.kicks-ass.net>
2025-04-14 19:57       ` Rik van Riel
2025-04-15  8:02         ` Peter Zijlstra
2025-04-16 12:44           ` Peter Zijlstra
2025-04-16 14:19             ` Rik van Riel
2025-04-16 15:27               ` Chris Mason
2025-04-18 15:44               ` Peter Zijlstra
2025-04-18 23:49                 ` Omar Sandoval
2025-04-22  0:06                   ` Omar Sandoval
2025-04-22 14:13                     ` Peter Zijlstra
2025-04-22 15:14                       ` Peter Zijlstra
2025-04-25  8:53                         ` Omar Sandoval
2025-04-22 13:36                   ` Peter Zijlstra
2025-04-19  2:53                 ` Mike Galbraith
     [not found] <20250320173438.3562449-2-patcody@meta.com>
2025-03-24 15:56 ` Steven Rostedt

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=72cb8df7-42e7-4266-b014-7d43796b14d8@arm.com \
    --to=christian.loehle@arm.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=pat@patcody.io \
    --cc=patcody@meta.com \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=rostedt@goodmis.org \
    --cc=stable@vger.kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /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