]> 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:30:18 +0000 (15:30 +0200)
commit9e0743eb6dcfd2e7e998d1b3182344a3221c32ee
tree1f4860bbc5146eb8901d9be0d5c91bf339a91ce2
parent749137b41e7064ee8b8b1f04a5a27478226d09fc
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