Patch "mtd: rawnand: fsl_upm: Fix an off-by one test in fun_exec_op()" has been added to the 6.1-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

    mtd: rawnand: fsl_upm: Fix an off-by one test in fun_exec_op()

to the 6.1-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:
     mtd-rawnand-fsl_upm-fix-an-off-by-one-test-in-fun_ex.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 37276d181edb80cb952cbc487908ae2b988b87f6
Author: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
Date:   Wed Jul 19 23:55:01 2023 +0200

    mtd: rawnand: fsl_upm: Fix an off-by one test in fun_exec_op()
    
    [ Upstream commit c6abce60338aa2080973cd95be0aedad528bb41f ]
    
    'op-cs' is copied in 'fun->mchip_number' which is used to access the
    'mchip_offsets' and the 'rnb_gpio' arrays.
    These arrays have NAND_MAX_CHIPS elements, so the index must be below this
    limit.
    
    Fix the sanity check in order to avoid the NAND_MAX_CHIPS value. This
    would lead to out-of-bound accesses.
    
    Fixes: 54309d657767 ("mtd: rawnand: fsl_upm: Implement exec_op()")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
    Reviewed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
    Link: https://lore.kernel.org/linux-mtd/cd01cba1c7eda58bdabaae174c78c067325803d2.1689803636.git.christophe.jaillet@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mtd/nand/raw/fsl_upm.c b/drivers/mtd/nand/raw/fsl_upm.c
index b3cc427100a22..636e65328bb32 100644
--- a/drivers/mtd/nand/raw/fsl_upm.c
+++ b/drivers/mtd/nand/raw/fsl_upm.c
@@ -135,7 +135,7 @@ static int fun_exec_op(struct nand_chip *chip, const struct nand_operation *op,
 	unsigned int i;
 	int ret;
 
-	if (op->cs > NAND_MAX_CHIPS)
+	if (op->cs >= NAND_MAX_CHIPS)
 		return -EINVAL;
 
 	if (check_only)



[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