* [PATCH v3] media: venus: fix use after free in vdec_close
@ 2024-05-06 5:58 Dikshita Agarwal
2024-05-06 7:33 ` Krzysztof Kozlowski
0 siblings, 1 reply; 2+ messages in thread
From: Dikshita Agarwal @ 2024-05-06 5:58 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bjorn Andersson, Konrad Dybcio,
Mauro Carvalho Chehab, Hans Verkuil
Cc: Bryan O'Donoghue, Stanimir Varbanov, linux-media,
linux-arm-msm, linux-kernel, Dikshita Agarwal, stable
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: af2c3834c ("media: venus: adding core part and helper functions")
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
---
Changes since v2:
- fixed email id
Changes since v1:
- Added fixes and stable tags
drivers/media/platform/qcom/venus/vdec.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index 29130a9..56f8a25 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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3] media: venus: fix use after free in vdec_close
2024-05-06 5:58 [PATCH v3] media: venus: fix use after free in vdec_close Dikshita Agarwal
@ 2024-05-06 7:33 ` Krzysztof Kozlowski
0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2024-05-06 7:33 UTC (permalink / raw)
To: Dikshita Agarwal, Stanimir Varbanov, Vikash Garodia,
Bjorn Andersson, Konrad Dybcio, Mauro Carvalho Chehab,
Hans Verkuil
Cc: Bryan O'Donoghue, Stanimir Varbanov, linux-media,
linux-arm-msm, linux-kernel, stable
On 06/05/2024 07:58, Dikshita Agarwal wrote:
> 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: af2c3834c ("media: venus: adding core part and helper functions")
Please run scripts/checkpatch.pl and fix reported warnings. Then please
run `scripts/checkpatch.pl --strict` and (probably) fix more warnings.
Some warnings can be ignored, especially from --strict run, but the code
here looks like it needs a fix. Feel free to get in touch if the warning
is not clear.
This is written in your instruction - go/upstream - so be sure you
always follow it fully.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-06 7:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-06 5:58 [PATCH v3] media: venus: fix use after free in vdec_close Dikshita Agarwal
2024-05-06 7:33 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox