linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fritz Koenig <frkoenig@chromium.org>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-media@vger.kernel.org,
	Stanimir Varbanov <stanimir.varbanov@linaro.org>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	vgarodia@codeaurora.org, mansur@codeaurora.org,
	Rajeshwar Kurapaty <rkurapat@qti.qualcomm.com>,
	Giri Kapalli <gkapalli@qti.qualcomm.com>
Subject: Re: [PATCH] venus: fixes for list corruption
Date: Fri, 7 Aug 2020 16:17:30 -0700	[thread overview]
Message-ID: <CAMfZQbxE1KAC03_7L1qqkb1gDr12SoO-UFs+UN9jAhQ6dCs0zQ@mail.gmail.com> (raw)
In-Reply-To: <20200804114845.25086-1-user@vgarodia-linux>

On Tue, Aug 4, 2020 at 5:23 AM Vikash Garodia <"Vikash
Garodia"@qti.qualcomm.com> wrote:
>
> From: Vikash Garodia <vgarodia@codeaurora.org>
>
> There are few list handling issues while adding and deleting
> node in the registered buf list in the driver.
> 1. list addition - buffer added into the list during buf_init
> while not deleted during cleanup.
> 2. list deletion - In capture streamoff, the list was reinitialized.
> As a result, if any node was present in the list, it would
> lead to issue while cleaning up that node during buf_cleanup.
>
> Corresponding call traces below:
> [  165.751014] Call trace:
> [  165.753541]  __list_add_valid+0x58/0x88
> [  165.757532]  venus_helper_vb2_buf_init+0x74/0xa8 [venus_core]
> [  165.763450]  vdec_buf_init+0x34/0xb4 [venus_dec]
> [  165.768271]  __buf_prepare+0x598/0x8a0 [videobuf2_common]
> [  165.773820]  vb2_core_qbuf+0xb4/0x334 [videobuf2_common]
> [  165.779298]  vb2_qbuf+0x78/0xb8 [videobuf2_v4l2]
> [  165.784053]  v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem]
> [  165.789067]  v4l2_m2m_ioctl_qbuf+0x2c/0x38 [v4l2_mem2mem]
> [  165.794624]  v4l_qbuf+0x48/0x58
>
> [ 1797.556001] Call trace:
> [ 1797.558516]  __list_del_entry_valid+0x88/0x9c
> [ 1797.562989]  vdec_buf_cleanup+0x54/0x228 [venus_dec]
> [ 1797.568088]  __buf_prepare+0x270/0x8a0 [videobuf2_common]
> [ 1797.573625]  vb2_core_qbuf+0xb4/0x338 [videobuf2_common]
> [ 1797.579082]  vb2_qbuf+0x78/0xb8 [videobuf2_v4l2]
> [ 1797.583830]  v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem]
> [ 1797.588843]  v4l2_m2m_ioctl_qbuf+0x2c/0x38 [v4l2_mem2mem]
> [ 1797.594389]  v4l_qbuf+0x48/0x58
>
> Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
> ---
>  drivers/media/platform/qcom/venus/vdec.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> index 7c4c483d5438..76be14efbfb0 100644
> --- a/drivers/media/platform/qcom/venus/vdec.c
> +++ b/drivers/media/platform/qcom/venus/vdec.c
> @@ -1088,8 +1088,6 @@ static int vdec_stop_capture(struct venus_inst *inst)
>                 break;
>         }
>
> -       INIT_LIST_HEAD(&inst->registeredbufs);
> -
>         return ret;
>  }
>
> @@ -1189,6 +1187,14 @@ static int vdec_buf_init(struct vb2_buffer *vb)
>  static void vdec_buf_cleanup(struct vb2_buffer *vb)
>  {
>         struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue);
> +       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
> +       struct venus_buffer *buf = to_venus_buffer(vbuf);
> +
> +       mutex_lock(&inst->lock);
> +       if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
> +               if (!list_empty(&inst->registeredbufs))
> +                       list_del_init(&buf->reg_list);
> +       mutex_unlock(&inst->lock);
>
>         inst->buf_count--;
>         if (!inst->buf_count)
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
Reviewed-by: Fritz Koenig <frkoenig@chromium.org>

      reply	other threads:[~2020-08-07 23:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 11:48 [PATCH] venus: fixes for list corruption Vikash Garodia
2020-08-07 23:17 ` Fritz Koenig [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=CAMfZQbxE1KAC03_7L1qqkb1gDr12SoO-UFs+UN9jAhQ6dCs0zQ@mail.gmail.com \
    --to=frkoenig@chromium.org \
    --cc=gkapalli@qti.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mansur@codeaurora.org \
    --cc=rkurapat@qti.qualcomm.com \
    --cc=stanimir.varbanov@linaro.org \
    --cc=vgarodia@codeaurora.org \
    /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;
as well as URLs for NNTP newsgroup(s).