From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Dikshita Agarwal <quic_dikshita@quicinc.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
Stanimir Varbanov <stanimir.k.varbanov@gmail.com>,
Vikash Garodia <quic_vgarodia@quicinc.com>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Tomasz Figa <tfiga@google.com>
Subject: Re: [PATCHv3 1/3] media: venus: fix enc/dec destruction order
Date: Fri, 25 Oct 2024 18:47:49 +0900 [thread overview]
Message-ID: <20241025094749.GP1279924@google.com> (raw)
In-Reply-To: <9a818584-3f14-ac6e-149d-901668956233@quicinc.com>
On (24/10/25 12:50), Dikshita Agarwal wrote:
> > diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> > index 6252a6b3d4ba..0013c4704f03 100644
> > --- a/drivers/media/platform/qcom/venus/vdec.c
> > +++ b/drivers/media/platform/qcom/venus/vdec.c
> > @@ -1752,13 +1752,14 @@ static int vdec_close(struct file *file)
> > cancel_work_sync(&inst->delayed_process_work);
> > v4l2_m2m_ctx_release(inst->m2m_ctx);
> > v4l2_m2m_release(inst->m2m_dev);
> > - vdec_ctrl_deinit(inst);
> > ida_destroy(&inst->dpb_ids);
> > hfi_session_destroy(inst);
> > - mutex_destroy(&inst->lock);
> > - mutex_destroy(&inst->ctx_q_lock);
> > v4l2_fh_del(&inst->fh);
> > v4l2_fh_exit(&inst->fh);
> > + vdec_ctrl_deinit(inst);
> Why vdec_ctrl_deinit ->v4l2_ctrl_handler_free(&inst->ctrl_handler) needs to
> be called after v4l2_fh_exit?
> Ideally it should be before v4l2_fh_exit.
Because ->fh holds a pointer to ->ctrl_handler
inst->fh.ctrl_handler = &inst->ctrl_handler
so after vdec_ctrl_deinit() fh holds stale (released) data.
In general destruction in reverse order of initialization is
safer.
init:
init ctrl
init fh // using ctrl
de-init:
release fh
release ctrl
next prev parent reply other threads:[~2024-10-25 9:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 3:46 [PATCHv3 0/3] media: venus: close() fixes Sergey Senozhatsky
2024-10-25 3:46 ` [PATCHv3 1/3] media: venus: fix enc/dec destruction order Sergey Senozhatsky
2024-10-25 7:20 ` Dikshita Agarwal
2024-10-25 9:47 ` Sergey Senozhatsky [this message]
2024-10-25 3:46 ` [PATCHv3 2/3] media: venus: sync with threaded IRQ during inst destruction Sergey Senozhatsky
2024-10-25 3:46 ` [PATCHv3 3/3] media: venus: factor out inst destruction routine Sergey Senozhatsky
2024-10-25 8:06 ` Dikshita Agarwal
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=20241025094749.GP1279924@google.com \
--to=senozhatsky@chromium.org \
--cc=bryan.odonoghue@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=quic_dikshita@quicinc.com \
--cc=quic_vgarodia@quicinc.com \
--cc=stanimir.k.varbanov@gmail.com \
--cc=tfiga@google.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
all inboxes | Powered by JetHome®