Commit 8da993db authored by Dikshita Agarwal's avatar Dikshita Agarwal Committed by Xia Fukun
Browse files

media: venus: fix use after free in vdec_close

stable inclusion
from stable-v5.10.224
commit 4c9d235630d35db762b85a4149bbb0be9d504c36
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAKQ1L
CVE: CVE-2024-42313

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.10.y&id=4c9d235630d35db762b85a4149bbb0be9d504c36



--------------------------------

commit a0157b5aa34eb43ec4c5510f9c260bbb03be937e upstream.

There appears to be a possible use after free with vdec_close().
The firmware will add buffer release work to the work queue through
HFI callbacks as a normal part of decoding. Randomly closing the
decoder device from userspace during normal decoding can incur
a read after free for inst.

Fix it by cancelling the work in vdec_close.

Cc: stable@vger.kernel.org
Fixes: af2c3834 ("[media] media: venus: adding core part and helper functions")
Signed-off-by: default avatarDikshita Agarwal <quic_dikshita@quicinc.com>
Acked-by: default avatarVikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: default avatarStanimir Varbanov <stanimir.k.varbanov@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarXia Fukun <xiafukun@huawei.com>
parent b1a66435
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1587,6 +1587,7 @@ static int vdec_close(struct file *file)

	vdec_pm_get(inst);

	cancel_work_sync(&inst->delayed_process_work);
	v4l2_m2m_ctx_release(inst->m2m_ctx);
	v4l2_m2m_release(inst->m2m_dev);
	vdec_ctrl_deinit(inst);