From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Brandon Brnich <b-brnich@ti.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: detheridge@ti.com, mchehab@kernel.org, nas.chung@chipsnmedia.com,
jackson.lee@chipsnmedia.com
Subject: Re: [PATCH 1/2] media: chips-media: wave5: Release m2m_ctx after Instance Removed from List
Date: Wed, 29 Apr 2026 14:29:15 -0400 [thread overview]
Message-ID: <1b8dbb58255edf9162d210061ad568d31f4e6848.camel@collabora.com> (raw)
In-Reply-To: <20260402184554.1751445-1-b-brnich@ti.com>
[-- Attachment #1: Type: text/plain, Size: 1532 bytes --]
Le jeudi 02 avril 2026 à 13:45 -0500, Brandon Brnich a écrit :
> Possible use after free if IRQ thread manages to obtain spinlock between
> m2m_ctx release and wave5_release function removing stream instance from
> list of active instances. The IRQ thread looks for the m2m_ctx which is
> freed so null pointer dereference occurs.
>
> Signed-off-by: Brandon Brnich <b-brnich@ti.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> drivers/media/platform/chips-media/wave5/wave5-helper.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-helper.c b/drivers/media/platform/chips-media/wave5/wave5-helper.c
> index 53a0ac068c2e..c3d34be833ff 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-helper.c
> +++ b/drivers/media/platform/chips-media/wave5/wave5-helper.c
> @@ -68,7 +68,6 @@ int wave5_vpu_release_device(struct file *filp,
> int ret = 0;
> unsigned long flags;
>
> - v4l2_m2m_ctx_release(inst->v4l2_fh.m2m_ctx);
> /*
> * To prevent Null reference exception, the existing irq handler were
> * separated to two modules.
> @@ -89,6 +88,9 @@ int wave5_vpu_release_device(struct file *filp,
> list_del_init(&inst->list);
> spin_unlock_irqrestore(&inst->dev->irq_spinlock, flags);
> mutex_unlock(&inst->dev->irq_lock);
> +
> + v4l2_m2m_ctx_release(inst->v4l2_fh.m2m_ctx);
> +
> if (inst->state != VPU_INST_STATE_NONE) {
> u32 fail_res;
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2026-04-29 18:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 18:45 [PATCH 1/2] media: chips-media: wave5: Release m2m_ctx after Instance Removed from List Brandon Brnich
2026-04-02 18:45 ` [PATCH 2/2] media: chips-media: wave5: Fix Reports from Kernel Lock Validator Brandon Brnich
2026-04-03 0:52 ` jackson.lee
2026-04-29 18:32 ` Nicolas Dufresne
2026-04-03 0:51 ` [PATCH 1/2] media: chips-media: wave5: Release m2m_ctx after Instance Removed from List jackson.lee
2026-04-29 18:29 ` Nicolas Dufresne [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=1b8dbb58255edf9162d210061ad568d31f4e6848.camel@collabora.com \
--to=nicolas.dufresne@collabora.com \
--cc=b-brnich@ti.com \
--cc=detheridge@ti.com \
--cc=jackson.lee@chipsnmedia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nas.chung@chipsnmedia.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