aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDikshita Agarwal <[email protected]>2024-05-09 10:44:29 +0530
committerHans Verkuil <[email protected]>2024-06-30 11:22:44 +0200
commita0157b5aa34eb43ec4c5510f9c260bbb03be937e (patch)
tree82a3013814ce2d56acec91510255096f51aad35f
parent193b3dac29a441fb72d2bbc3b4c4ebf2961e3c27 (diff)
media: venus: fix use after free in vdec_close
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: [email protected] Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions") Signed-off-by: Dikshita Agarwal <[email protected]> Acked-by: Vikash Garodia <[email protected]> Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
-rw-r--r--drivers/media/platform/qcom/venus/vdec.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index 0d2ab95bec0f..d12089370d91 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -1747,6 +1747,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);