The patch titled Subject: mm/mempolicy: fix get_nodes out of bound access has been added to the -mm mm-unstable branch. Its filename is mm-mempolicy-fix-get_nodes-out-of-bound-access.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mempolicy-fix-get_nodes-out-of-bound-access.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Tianyu Li <tianyu.li@xxxxxxx> Subject: mm/mempolicy: fix get_nodes out of bound access Date: Wed, 1 Jun 2022 17:32:11 +0800 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@xxxxxxx Fixes: e130242dc351 ("mm: simplify compat numa syscalls") Signed-off-by: Tianyu Li <tianyu.li@xxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/mempolicy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/mempolicy.c~mm-mempolicy-fix-get_nodes-out-of-bound-access +++ a/mm/mempolicy.c @@ -1397,7 +1397,7 @@ static int get_nodes(nodemask_t *nodes, 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) { _ Patches currently in -mm which might be from tianyu.li@xxxxxxx are mm-mempolicy-fix-get_nodes-out-of-bound-access.patch