Commit cbbe7613 authored by Luca Weiss's avatar Luca Weiss Committed by Liu Shixin
Browse files

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 86594f6a ]

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: default avatarLuca Weiss <luca.weiss@fairphone.com>
Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
parent 72481518
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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)