Commit 5657c11
sched/core: Fix NULL pointer access fault in sched_setaffinity() with non-SMP configs
The kernel commit 9a5418b ("sched/core: Use kfree_rcu() in
do_set_cpus_allowed()") introduces a bug for kernels built with non-SMP
configs. Calling sched_setaffinity() on such a uniprocessor kernel will
cause cpumask_copy() to be called with a NULL pointer leading to general
protection fault. This is not really a problem in real use cases as
there aren't that many uniprocessor kernel configs in use and calling
sched_setaffinity() on such a uniprocessor system doesn't make sense.
Fix this problem by making sure cpumask_copy() will not be called in
such a case.
Fixes: 9a5418b ("sched/core: Use kfree_rcu() in do_set_cpus_allowed()")
Reported-by: kernel test robot <yujie.liu@intel.com>
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230115193122.563036-1-longman@redhat.com1 parent da07d2f commit 5657c11
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8290 | 8290 | | |
8291 | 8291 | | |
8292 | 8292 | | |
| 8293 | + | |
| 8294 | + | |
| 8295 | + | |
| 8296 | + | |
8293 | 8297 | | |
8294 | | - | |
| 8298 | + | |
| 8299 | + | |
| 8300 | + | |
8295 | 8301 | | |
8296 | 8302 | | |
8297 | 8303 | | |
8298 | | - | |
| 8304 | + | |
8299 | 8305 | | |
8300 | 8306 | | |
8301 | 8307 | | |
| |||
0 commit comments