From 12a570651b002c870ada2982a8d80b936fd0f1b7 Mon Sep 17 00:00:00 2001 From: ptak Date: Thu, 11 Jul 2024 17:07:43 +0530 Subject: [PATCH] msm: eva: Fix UAF issue when remove module Should use different way to get the core info for different device. Change-Id: I8231d08afa75a1f47781f54ec2e5fa264820cc9e Signed-off-by: ptak --- drivers/media/platform/msm/cvp/cvp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/msm/cvp/cvp.c b/drivers/media/platform/msm/cvp/cvp.c index cf3e4b530d99..87adb4fbd975 100644 --- a/drivers/media/platform/msm/cvp/cvp.c +++ b/drivers/media/platform/msm/cvp/cvp.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -491,7 +492,11 @@ static int msm_cvp_remove(struct platform_device *pdev) return -EINVAL; } - core = dev_get_drvdata(&pdev->dev); + if (of_device_is_compatible(pdev->dev.of_node, "qcom,msm-cvp")) + core = dev_get_drvdata(&pdev->dev); + else + core = dev_get_drvdata(pdev->dev.parent); + if (!core) { dprintk(CVP_ERR, "%s invalid core", __func__); return -EINVAL;