Patch "of: fdt: fix off-by-one error in unflatten_dt_nodes()" has been added to the 5.15-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

    of: fdt: fix off-by-one error in unflatten_dt_nodes()

to the 5.15-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:
     of-fdt-fix-off-by-one-error-in-unflatten_dt_nodes.patch
and it can be found in the queue-5.15 subdirectory.

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



commit a03aaca34c09a5435f30660a786e82c7abbc24c6
Author: Sergey Shtylyov <s.shtylyov@xxxxxx>
Date:   Sat Aug 13 23:34:16 2022 +0300

    of: fdt: fix off-by-one error in unflatten_dt_nodes()
    
    [ Upstream commit 2f945a792f67815abca26fa8a5e863ccf3fa1181 ]
    
    Commit 78c44d910d3e ("drivers/of: Fix depth when unflattening devicetree")
    forgot to fix up the depth check in the loop body in unflatten_dt_nodes()
    which makes it possible to overflow the nps[] buffer...
    
    Found by Linux Verification Center (linuxtesting.org) with the SVACE static
    analysis tool.
    
    Fixes: 78c44d910d3e ("drivers/of: Fix depth when unflattening devicetree")
    Signed-off-by: Sergey Shtylyov <s.shtylyov@xxxxxx>
    Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/7c354554-006f-6b31-c195-cdfe4caee392@xxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index d245628b15dd..338171c978cc 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -313,7 +313,7 @@ static int unflatten_dt_nodes(const void *blob,
 	for (offset = 0;
 	     offset >= 0 && depth >= initial_depth;
 	     offset = fdt_next_node(blob, offset, &depth)) {
-		if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH))
+		if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH - 1))
 			continue;
 
 		if (!IS_ENABLED(CONFIG_OF_KOBJ) &&



[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