[PATCH openEuler-1.0-LTS] media: venus: hfi: avoid null dereference in deinit

From: Luca Weiss <luca.weiss@fairphone.com> 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=... -------------------------------- [ 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 <luca.weiss@fairphone.com> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Liu Shixin <liushixin2@huawei.com> --- 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) -- 2.34.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/15485 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/UH3... 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/15485 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/UH3...
participants (2)
-
Liu Shixin
-
patchwork bot