]> git.itanic.dy.fi Git - linux-stable/commit
of: fdt: fix off-by-one error in unflatten_dt_nodes()
authorSergey Shtylyov <s.shtylyov@omp.ru>
Sat, 13 Aug 2022 20:34:16 +0000 (23:34 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 09:02:51 +0000 (11:02 +0200)
commit2566706ac6393386a4e7c4ce23fe17f4c98d9aa0
tree5241b03cca58b5e78baf49ebe943d3958aaa27ba
parent970451bc1c8159107c9df161c1331cc9aea4c4d2
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@omp.ru>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/7c354554-006f-6b31-c195-cdfe4caee392@omp.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/of/fdt.c