[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220815142137.29982-1-91tuocao@gmail.com>
Date: Mon, 15 Aug 2022 22:21:37 +0800
From: Tuo Cao <91tuocao@...il.com>
To: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org
Cc: dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
linux-kernel@...r.kernel.org, 91tuocao@...il.com
Subject: [PATCH] sched: core: remove access_ok() before copy_to_user()
If usize > ksize, usize may be not valid and if(!access_ok()) will return
-EFAULT. But ksize may be valid, copy_to_user() should be executed.And
also, copy_to_user() will calls access_ok() to test whether a block of
memory is a valid user space address.
Signed-off-by: Tuo Cao <91tuocao@...il.com>
---
kernel/sched/core.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ee28253c9ac0..fe6a65a54626 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7975,9 +7975,6 @@ sched_attr_copy_to_user(struct sched_attr __user *uattr,
{
unsigned int ksize = sizeof(*kattr);
- if (!access_ok(uattr, usize))
- return -EFAULT;
-
/*
* sched_getattr() ABI forwards and backwards compatibility:
*
--
2.17.1
Powered by blists - more mailing lists