From: Khaled ROMDHANI <khaledromdhani216@gmail.com>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
bristot@redhat.com
Cc: Khaled ROMDHANI <khaledromdhani216@gmail.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH-next] sched: Fix Dereference after null check
Date: Sat, 15 May 2021 18:11:17 +0100 [thread overview]
Message-ID: <20210515171117.23240-1-khaledromdhani216@gmail.com> (raw)
The group_cfs_rq derefrence the 'se' variable that could
be passed as NULL pointer. Fix this by adding a check
against the sched entity 'se' before the derefrence.
Addresses-Coverity: ("Dereference after null check")
Signed-off-by: Khaled ROMDHANI <khaledromdhani216@gmail.com>
---
kernel/sched/fair.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 161b92aa1c79..9be6cdba351d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7080,7 +7080,8 @@ static struct task_struct *pick_task_fair(struct rq *rq)
}
se = pick_next_entity(cfs_rq, curr);
- cfs_rq = group_cfs_rq(se);
+ if (se)
+ cfs_rq = group_cfs_rq(se);
} while (cfs_rq);
return task_of(se);
--
2.17.1
next reply other threads:[~2021-05-15 17:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 17:11 Khaled ROMDHANI [this message]
2021-05-15 21:04 ` [PATCH-next] sched: Fix Dereference after null check Peter Zijlstra
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=20210515171117.23240-1-khaledromdhani216@gmail.com \
--to=khaledromdhani216@gmail.com \
--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=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--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).