[PATCH OLK-5.10] soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()

From: Chenyuan Yang <chenyuan0y@gmail.com> stable inclusion from stable-v5.10.237 commit 8ce469d23205249bb17c1135ccadea879576adfc category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IC5BL6 CVE: CVE-2025-23148 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=... -------------------------------- [ Upstream commit c8222ef6cf29dd7cad21643228f96535cc02b327 ] soc_dev_attr->revision could be NULL, thus, a pointer check is added to prevent potential NULL pointer dereference. This is similar to the fix in commit 3027e7b15b02 ("ice: Fix some null pointer dereference issues in ice_ptp.c"). This issue is found by our static analysis tool. Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com> Link: https://lore.kernel.org/r/20250212213518.69432-1-chenyuan0y@gmail.com Fixes: 3253b7b7cd44 ("soc: samsung: Add exynos chipid driver support") Cc: <stable@vger.kernel.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Liu Mingrui <liumingrui@huawei.com> Conflicts: drivers/soc/samsung/exynos-chipid.c [wxf: fix context conflicts] Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com> --- drivers/soc/samsung/exynos-chipid.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c index 8d4d050869068..421dedbf2975e 100644 --- a/drivers/soc/samsung/exynos-chipid.c +++ b/drivers/soc/samsung/exynos-chipid.c @@ -84,6 +84,8 @@ static int __init exynos_chipid_early_init(void) of_node_put(root); soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%x", revision); + if (!soc_dev_attr->revision) + return -ENOMEM; soc_dev_attr->soc_id = product_id_to_soc_id(product_id); if (!soc_dev_attr->soc_id) { pr_err("Unknown SoC\n"); -- 2.20.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/16551 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/WQT... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/16551 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/WQT...
participants (2)
-
patchwork bot
-
Xiongfeng Wang