* [PATCH v2] media: qcom: iris: Add sanity check for stop streaming
@ 2025-10-21 8:15 ` Wangao Wang
2025-10-21 11:27 ` Bryan O'Donoghue
2025-10-27 6:02 ` Dikshita Agarwal
0 siblings, 2 replies; 3+ messages in thread
From: Wangao Wang @ 2025-10-21 8:15 UTC (permalink / raw)
To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar,
Bryan O'Donoghue, Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel, quic_qiweil,
quic_renjiang, Wangao Wang
Add sanity check in iris_vb2_stop_streaming. If inst->state is
already IRIS_INST_ERROR, we should skip the stream_off operation
because it would still send packets to the firmware.
In iris_vdec_kill_session, inst->state is set to IRIS_INST_ERROR
and session_close is executed, which will kfree(inst_hfi_gen2->packet).
If stop_streaming is called afterward, it will cause a crash.
Signed-off-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
---
Changes in v2:
- Remove redundant ret assignment in ERROR state.
- Perform error handling according to the value of ret.
- Link to v1: https://lore.kernel.org/r/20251016072517.4845-1-wangao.wang@oss.qualcomm.com
---
drivers/media/platform/qcom/iris/iris_vb2.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/qcom/iris/iris_vb2.c b/drivers/media/platform/qcom/iris/iris_vb2.c
index 139b821f7952feb33b21a7045aef9e8a4782aa3c..db8768d8a8f61c9ceb04e423d0a769d35114e20e 100644
--- a/drivers/media/platform/qcom/iris/iris_vb2.c
+++ b/drivers/media/platform/qcom/iris/iris_vb2.c
@@ -231,6 +231,8 @@ void iris_vb2_stop_streaming(struct vb2_queue *q)
return;
mutex_lock(&inst->lock);
+ if (inst->state == IRIS_INST_ERROR)
+ goto exit;
if (!V4L2_TYPE_IS_OUTPUT(q->type) &&
!V4L2_TYPE_IS_CAPTURE(q->type))
@@ -241,10 +243,10 @@ void iris_vb2_stop_streaming(struct vb2_queue *q)
goto exit;
exit:
- iris_helper_buffers_done(inst, q->type, VB2_BUF_STATE_ERROR);
- if (ret)
+ if (ret) {
+ iris_helper_buffers_done(inst, q->type, VB2_BUF_STATE_ERROR);
iris_inst_change_state(inst, IRIS_INST_ERROR);
-
+ }
mutex_unlock(&inst->lock);
}
---
base-commit: 13863a59e410cab46d26751941980dc8f088b9b3
change-id: 20251021-iris_add_sanity_check-34a0795745b1
Best regards,
--
Wangao Wang <wangao.wang@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] media: qcom: iris: Add sanity check for stop streaming
2025-10-21 8:15 ` [PATCH v2] media: qcom: iris: Add sanity check for stop streaming Wangao Wang
@ 2025-10-21 11:27 ` Bryan O'Donoghue
2025-10-27 6:02 ` Dikshita Agarwal
1 sibling, 0 replies; 3+ messages in thread
From: Bryan O'Donoghue @ 2025-10-21 11:27 UTC (permalink / raw)
To: Wangao Wang, Vikash Garodia, Dikshita Agarwal, Abhinav Kumar,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel, quic_qiweil, quic_renjiang
On 21/10/2025 09:15, Wangao Wang wrote:
> Add sanity check in iris_vb2_stop_streaming. If inst->state is
> already IRIS_INST_ERROR, we should skip the stream_off operation
> because it would still send packets to the firmware.
>
> In iris_vdec_kill_session, inst->state is set to IRIS_INST_ERROR
> and session_close is executed, which will kfree(inst_hfi_gen2->packet).
> If stop_streaming is called afterward, it will cause a crash.
>
> Signed-off-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
Requires a Fixes: tag
Then add
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] media: qcom: iris: Add sanity check for stop streaming
2025-10-21 8:15 ` [PATCH v2] media: qcom: iris: Add sanity check for stop streaming Wangao Wang
2025-10-21 11:27 ` Bryan O'Donoghue
@ 2025-10-27 6:02 ` Dikshita Agarwal
1 sibling, 0 replies; 3+ messages in thread
From: Dikshita Agarwal @ 2025-10-27 6:02 UTC (permalink / raw)
To: Wangao Wang, Vikash Garodia, Abhinav Kumar, Bryan O'Donoghue,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel, quic_qiweil, quic_renjiang
On 10/21/2025 1:45 PM, Wangao Wang wrote:
> Add sanity check in iris_vb2_stop_streaming. If inst->state is
> already IRIS_INST_ERROR, we should skip the stream_off operation
> because it would still send packets to the firmware.
>
> In iris_vdec_kill_session, inst->state is set to IRIS_INST_ERROR
> and session_close is executed, which will kfree(inst_hfi_gen2->packet).
> If stop_streaming is called afterward, it will cause a crash.
>
> Signed-off-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
with fixes tag added.
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Thanks,
Dikshita
> ---
> Changes in v2:
> - Remove redundant ret assignment in ERROR state.
> - Perform error handling according to the value of ret.
> - Link to v1: https://lore.kernel.org/r/20251016072517.4845-1-wangao.wang@oss.qualcomm.com
> ---
> drivers/media/platform/qcom/iris/iris_vb2.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/iris/iris_vb2.c b/drivers/media/platform/qcom/iris/iris_vb2.c
> index 139b821f7952feb33b21a7045aef9e8a4782aa3c..db8768d8a8f61c9ceb04e423d0a769d35114e20e 100644
> --- a/drivers/media/platform/qcom/iris/iris_vb2.c
> +++ b/drivers/media/platform/qcom/iris/iris_vb2.c
> @@ -231,6 +231,8 @@ void iris_vb2_stop_streaming(struct vb2_queue *q)
> return;
>
> mutex_lock(&inst->lock);
> + if (inst->state == IRIS_INST_ERROR)
> + goto exit;
>
> if (!V4L2_TYPE_IS_OUTPUT(q->type) &&
> !V4L2_TYPE_IS_CAPTURE(q->type))
> @@ -241,10 +243,10 @@ void iris_vb2_stop_streaming(struct vb2_queue *q)
> goto exit;
>
> exit:
> - iris_helper_buffers_done(inst, q->type, VB2_BUF_STATE_ERROR);
> - if (ret)
> + if (ret) {
> + iris_helper_buffers_done(inst, q->type, VB2_BUF_STATE_ERROR);
> iris_inst_change_state(inst, IRIS_INST_ERROR);
> -
> + }
> mutex_unlock(&inst->lock);
> }
>
>
> ---
> base-commit: 13863a59e410cab46d26751941980dc8f088b9b3
> change-id: 20251021-iris_add_sanity_check-34a0795745b1
>
> Best regards,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-27 6:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <akmAGosBEsOFS3HpzbJdYH2z103MndEu9B6T4EBnkbPiuBpzCzjn8LtnVr-lJ0PHOqR0jYiIXbnPTwJR0B3L0g==@protonmail.internalid>
2025-10-21 8:15 ` [PATCH v2] media: qcom: iris: Add sanity check for stop streaming Wangao Wang
2025-10-21 11:27 ` Bryan O'Donoghue
2025-10-27 6:02 ` 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®