Patch "mtd: rawnand: intel: Fix potential buffer overflow in probe" has been added to the 5.14-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: intel: Fix potential buffer overflow in probe

to the 5.14-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-intel-fix-potential-buffer-overflow-in-p.patch
and it can be found in the queue-5.14 subdirectory.

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



commit 9f3ba4add8345917782a8881e1d7658f3c6e86a9
Author: Evgeny Novikov <novikov@xxxxxxxxx>
Date:   Fri Sep 3 11:26:53 2021 +0300

    mtd: rawnand: intel: Fix potential buffer overflow in probe
    
    [ Upstream commit 46a0dc10fb32bec3e765e51bf71fbc070dc77ca3 ]
    
    ebu_nand_probe() read the value of u32 variable "cs" from the device
    firmware description and used it as the index for array ebu_host->cs
    that can contain MAX_CS (2) elements at most. That could result in
    a buffer overflow and various bad consequences later.
    
    Fix the potential buffer overflow by restricting values of "cs" with
    MAX_CS in probe.
    
    Found by Linux Driver Verification project (linuxtesting.org).
    
    Fixes: 0b1039f016e8 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC")
    Signed-off-by: Evgeny Novikov <novikov@xxxxxxxxx>
    Co-developed-by: Kirill Shilimanov <kirill.shilimanov@xxxxxxxxxx>
    Signed-off-by: Kirill Shilimanov <kirill.shilimanov@xxxxxxxxxx>
    Co-developed-by: Anton Vasilyev <vasilyev@xxxxxxxxx>
    Signed-off-by: Anton Vasilyev <vasilyev@xxxxxxxxx>
    Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
    Link: https://lore.kernel.org/linux-mtd/20210903082653.16441-1-novikov@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c
index 29e8a546dcd60..e8476cd5147fe 100644
--- a/drivers/mtd/nand/raw/intel-nand-controller.c
+++ b/drivers/mtd/nand/raw/intel-nand-controller.c
@@ -609,6 +609,11 @@ static int ebu_nand_probe(struct platform_device *pdev)
 		dev_err(dev, "failed to get chip select: %d\n", ret);
 		return ret;
 	}
+	if (cs >= MAX_CS) {
+		dev_err(dev, "got invalid chip select: %d\n", cs);
+		return -EINVAL;
+	}
+
 	ebu_host->cs_num = cs;
 
 	resname = devm_kasprintf(dev, GFP_KERNEL, "nand_cs%d", cs);



[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