of: overlay: fix null pointer dereferencing in find_dup_cset_node_entry() and find_du...
authorruanjinjie <ruanjinjie@huawei.com>
Sun, 11 Dec 2022 02:33:37 +0000 (10:33 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:26 +0000 (13:32 +0100)
commit71d88c7453ec3d2ceff98e18ce4d6354abd3b5b6
tree90a87abd49429fa7296160499372cb35f32bd02c
parentcbde8b3acbc8d098240d8f423512689ffa84e80c
of: overlay: fix null pointer dereferencing in find_dup_cset_node_entry() and find_dup_cset_prop()

[ Upstream commit ee9d7a0e754568180a2f8ebc4aad226278a9116f ]

When kmalloc() fail to allocate memory in kasprintf(), fn_1 or fn_2 will
be NULL, and strcmp() will cause null pointer dereference.

Fixes: 2fe0e8769df9 ("of: overlay: check prevents multiple fragments touching same property")
Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20221211023337.592266-1-ruanjinjie@huawei.com
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/of/overlay.c