* [PATCH] media: venus: fix use after free in vdec_close
@ 2024-04-24 7:17 Dikshita Agarwal
2024-04-24 8:56 ` Bryan O'Donoghue
0 siblings, 1 reply; 4+ messages in thread
From: Dikshita Agarwal @ 2024-04-24 7:17 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bjorn Andersson,
Konrad Dybcio, Mauro Carvalho Chehab
Cc: Bryan O'Donoghue, linux-media, linux-arm-msm, linux-kernel,
Dikshita Agarwal
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.
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
---
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 [flat|nested] 4+ messages in thread
* Re: [PATCH] media: venus: fix use after free in vdec_close
2024-04-24 7:17 [PATCH] media: venus: fix use after free in vdec_close Dikshita Agarwal
@ 2024-04-24 8:56 ` Bryan O'Donoghue
0 siblings, 0 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2024-04-24 8:56 UTC (permalink / raw)
To: Dikshita Agarwal, Stanimir Varbanov, Vikash Garodia,
Bjorn Andersson, Konrad Dybcio, Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel
On 24/04/2024 08:17, 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.
>
> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> ---
> 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);
Needs a Fixes tag
---
bod
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] media: venus: fix use after free in vdec_close
@ 2024-04-05 15:51 Dikshita Agarwal
2024-04-05 16:19 ` Dikshita Agarwal
0 siblings, 1 reply; 4+ messages in thread
From: Dikshita Agarwal @ 2024-04-05 15:51 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bjorn Andersson,
Konrad Dybcio, Mauro Carvalho Chehab
Cc: Bryan O'Donoghue, linux-media, linux-arm-msm, linux-kernel,
Dikshita Agarwal
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 delayed work in vdec_close.
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
---
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..8dda46a 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_delayed_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 [flat|nested] 4+ messages in thread
* Re: [PATCH] media: venus: fix use after free in vdec_close
2024-04-05 15:51 Dikshita Agarwal
@ 2024-04-05 16:19 ` Dikshita Agarwal
0 siblings, 0 replies; 4+ messages in thread
From: Dikshita Agarwal @ 2024-04-05 16:19 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bjorn Andersson,
Konrad Dybcio, Mauro Carvalho Chehab
Cc: Bryan O'Donoghue, linux-media, linux-arm-msm, linux-kernel
Hello All,
Please ignore this patch, sent by mistake.
Sorry for spamming.
On 4/5/2024 9:21 PM, 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 delayed work in vdec_close.
>
> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> ---
> 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..8dda46a 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_delayed_work_sync(&inst->delayed_process_work);
> v4l2_m2m_ctx_release(inst->m2m_ctx);
> v4l2_m2m_release(inst->m2m_dev);
> vdec_ctrl_deinit(inst);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-24 8:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 7:17 [PATCH] media: venus: fix use after free in vdec_close Dikshita Agarwal
2024-04-24 8:56 ` Bryan O'Donoghue
-- strict thread matches above, loose matches on Subject: below --
2024-04-05 15:51 Dikshita Agarwal
2024-04-05 16:19 ` Dikshita Agarwal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®