From cbbe7613b149ab89ec5d2992da4b6b829d1d6078 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Fri, 14 Mar 2025 11:24:43 +0800 Subject: [PATCH] media: venus: hfi: avoid null dereference in deinit stable inclusion from stable-v4.19.247 commit a21d15dde21d7e8ae047eb8368677407db45d840 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBP6S3 CVE: CVE-2022-49527 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a21d15dde21d7e8ae047eb8368677407db45d840 -------------------------------- [ Upstream commit 86594f6af867b5165d2ba7b5a71fae3a5961e56c ] If venus_probe fails at pm_runtime_put_sync the error handling first calls hfi_destroy and afterwards hfi_core_deinit. As hfi_destroy sets core->ops to NULL, hfi_core_deinit cannot call the core_deinit function anymore. Avoid this null pointer derefence by skipping the call when necessary. Signed-off-by: Luca Weiss Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Signed-off-by: Liu Shixin --- drivers/media/platform/qcom/venus/hfi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index 24207829982f..8a99e2d8274a 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -113,6 +113,9 @@ int hfi_core_deinit(struct venus_core *core, bool blocking) mutex_lock(&core->lock); } + if (!core->ops) + goto unlock; + ret = core->ops->core_deinit(core); if (!ret) -- Gitee