Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
To: Wangao Wang <wangao.wang@oss.qualcomm.com>,
	vikash.garodia@oss.qualcomm.com, abhinav.kumar@linux.dev,
	bod@kernel.org, mchehab@kernel.org
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, quic_qiweil@quicinc.com,
	quic_renjiang@quicinc.com
Subject: Re: [PATCH v1] media: qcom: iris: Add sanity check for stop streaming
Date: Thu, 16 Oct 2025 16:36:29 +0530	[thread overview]
Message-ID: <d2e0935c-4794-e5de-4baf-7ac7c323eca9@oss.qualcomm.com> (raw)
In-Reply-To: <20251016072517.4845-1-wangao.wang@oss.qualcomm.com>



On 10/16/2025 12:55 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>
> ---
>  drivers/media/platform/qcom/iris/iris_vb2.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_vb2.c b/drivers/media/platform/qcom/iris/iris_vb2.c
> index 139b821f7952..c1647fb4f0cc 100644
> --- a/drivers/media/platform/qcom/iris/iris_vb2.c
> +++ b/drivers/media/platform/qcom/iris/iris_vb2.c
> @@ -231,16 +231,20 @@ void iris_vb2_stop_streaming(struct vb2_queue *q)
>  		return;
>  
>  	mutex_lock(&inst->lock);
> +	if (inst->state == IRIS_INST_ERROR) {
> +		ret = -EBUSY;

ret is only used to trigger a state change to ERROR in this void API. Since
the instance is already in ERROR state, assigning ret = -EBUSY is redundant
and has no functional impact.

Thanks,
Dikshita
> +		goto error;
> +	}
>  
>  	if (!V4L2_TYPE_IS_OUTPUT(q->type) &&
>  	    !V4L2_TYPE_IS_CAPTURE(q->type))
> -		goto exit;
> +		goto error;
>  
>  	ret = iris_session_streamoff(inst, q->type);
>  	if (ret)
> -		goto exit;
> +		goto error;
>  
> -exit:
> +error:
>  	iris_helper_buffers_done(inst, q->type, VB2_BUF_STATE_ERROR);
>  	if (ret)
>  		iris_inst_change_state(inst, IRIS_INST_ERROR);

      parent reply	other threads:[~2025-10-16 11:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-16  7:25 [PATCH v1] media: qcom: iris: Add sanity check for stop streaming Wangao Wang
2025-10-16  8:59 ` Renjiang Han
2025-10-16 11:06 ` Dikshita Agarwal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d2e0935c-4794-e5de-4baf-7ac7c323eca9@oss.qualcomm.com \
    --to=dikshita.agarwal@oss.qualcomm.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=bod@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=quic_qiweil@quicinc.com \
    --cc=quic_renjiang@quicinc.com \
    --cc=vikash.garodia@oss.qualcomm.com \
    --cc=wangao.wang@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox