]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
of: dynamic: Fix use after free in of_changeset_add_prop_helper()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 22 Aug 2025 08:08:46 +0000 (11:08 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Sep 2025 13:31:43 +0000 (15:31 +0200)
commit0d3471ab7186cf468898fe12972aa16452f274c0
tree7e0d06356229e3af54e2ff396c7f447e2c4c10ba
parent76c872066d75f86f8d8a5def681da2aee811fc62
of: dynamic: Fix use after free in of_changeset_add_prop_helper()

[ Upstream commit 80af3745ca465c6c47e833c1902004a7fa944f37 ]

If the of_changeset_add_property() function call fails, then this code
frees "new_pp" and then dereference it on the next line.  Return the
error code directly instead.

Fixes: c81f6ce16785 ("of: dynamic: Fix memleak when of_pci_add_properties() failed")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/aKgljjhnpa4lVpdx@stanley.mountain
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/of/dynamic.c