From: Hongyan Xu <getshell@seu.edu.cn>
To: fabien.dessenne@foss.st.com, mchehab@kernel.org
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
jianhao.xu@seu.edu.cn, Hongyan Xu <getshell@seu.edu.cn>
Subject: [PATCH] media: bdisp: cancel timeout work before teardown
Date: Tue, 28 Jul 2026 21:52:24 +0800 [thread overview]
Message-ID: <20260728135224.928-1-getshell@seu.edu.cn> (raw)
bdisp_device_run() queues timeout_work with a non-zero delay. During
remove, bdisp_unregister_device() releases the V4L2 mem2mem device before
the private workqueue is destroyed. A pending timeout can therefore run
after v4l2_m2m_release() and pass the freed m2m_dev to
v4l2_m2m_get_curr_priv().
Pause the mem2mem scheduler first so the current job finishes and no new
job can rearm timeout_work. Then cancel the work synchronously before
unregistering the device. This guarantees that the callback has finished
using the driver data before the remaining resources are torn down.
This issue was found by a static analysis tool.
Fixes: 28ffeebbb7bd ("[media] bdisp: 2D blitter driver using v4l2 mem2mem framework")
Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
---
drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c
index ee6d686cb..5c92777cd 100644
--- a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c
+++ b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c
@@ -1261,6 +1261,9 @@ static void bdisp_remove(struct platform_device *pdev)
{
struct bdisp_dev *bdisp = platform_get_drvdata(pdev);
+ v4l2_m2m_suspend(bdisp->m2m.m2m_dev);
+ cancel_delayed_work_sync(&bdisp->timeout_work);
+
bdisp_unregister_device(bdisp);
bdisp_hw_free_filters(bdisp->dev);
--
2.50.1.windows.1
reply other threads:[~2026-07-28 13:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260728135224.928-1-getshell@seu.edu.cn \
--to=getshell@seu.edu.cn \
--cc=fabien.dessenne@foss.st.com \
--cc=jianhao.xu@seu.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.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
all inboxes | Powered by JetHome®