projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0b9f2f2
)
mm/mempolicy: fix get_nodes out of bound access
author
Tianyu Li
<tianyu.li@arm.com>
Wed, 1 Jun 2022 09:32:11 +0000
(17:32 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:47 +0000
(14:23 +0200)
[ Upstream commit
000eca5d044d1ee23b4ca311793cf3fc528da6c6
]
When user specified more nodes than supported, get_nodes will access nmask
array out of bounds.
Link:
https://lkml.kernel.org/r/20220601093211.2970565-1-tianyu.li@arm.com
Fixes: e130242dc351 ("mm: simplify compat numa syscalls")
Signed-off-by: Tianyu Li <tianyu.li@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mm/mempolicy.c
patch
|
blob
|
history
diff --git
a/mm/mempolicy.c
b/mm/mempolicy.c
index 9db0158155e1adbe74b0d6b2a89546015e8012c3..4472be6f123dbb3261466383779fe05eeb9e80e4 100644
(file)
--- a/
mm/mempolicy.c
+++ b/
mm/mempolicy.c
@@
-1389,7
+1389,7
@@
static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask,
unsigned long bits = min_t(unsigned long, maxnode, BITS_PER_LONG);
unsigned long t;
- if (get_bitmap(&t, &nmask[
maxnode
/ BITS_PER_LONG], bits))
+ if (get_bitmap(&t, &nmask[
(maxnode - 1)
/ BITS_PER_LONG], bits))
return -EFAULT;
if (maxnode - bits >= MAX_NUMNODES) {