Patch "mm/mempolicy: fix get_nodes out of bound access" has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mm/mempolicy: fix get_nodes out of bound access

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mm-mempolicy-fix-get_nodes-out-of-bound-access.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f8a3bf86c7948cde73acf4568b9cd26ef9333b31
Author: Tianyu Li <tianyu.li@xxxxxxx>
Date:   Wed Jun 1 17:32:11 2022 +0800

    mm/mempolicy: fix get_nodes out of bound access
    
    [ 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@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>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index b27e8d71cda3..c1ccc89845f4 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1387,7 +1387,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) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux