From: sashiko-bot@kernel.org
To: "Atanas Filipov" <atanas.filipov@oss.qualcomm.com>
Cc: media-ci@linuxtv.org, robh@kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v5 3/3] arm64: dts: qcom: sm8250: Add JPEG encoder node
Date: Tue, 28 Jul 2026 08:39:24 +0000 [thread overview]
Message-ID: <20260728083924.B01971F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260728082548.2511694-4-atanas.filipov@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Race condition in stream teardown can disable interrupts for active streams and cause hardware deadlocks.
--
--- Patch [3]: [PATCH v5 3/3] arm64: dts: qcom: sm8250: Add JPEG encoder node ---
commit 37f9191db4e80eea5cca3dd9978def555946b6b5
Author: Atanas Filipov <atanas.filipov@oss.qualcomm.com>
arm64: dts: qcom: sm8250: Add JPEG encoder node
Add the JPEG encoder hardware node to the SM8250 device tree so the
qcom-jpeg V4L2 encoder driver can bind and operate on this platform.
> diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi
> index 7076720413ab2..98935f3fcd05a 100644
> --- a/arch/arm64/boot/dts/qcom/sm8250.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi
[ ... ]
> @@ -4469,6 +4470,79 @@ cci1_i2c1: i2c-bus@1 {
> };
> };
>
> + jpeg-encoder@ac53000 {
[Severity: High]
Does enabling this device expose a race condition in the driver's stream
teardown sequence?
Looking at bop_jpeg_vb2_stop_streaming() in
drivers/media/platform/qcom/jpeg/qcom_jenc_v4l2.c, the lock is dropped
before calling hw_release():
mutex_unlock(&jenc->dev_mutex);
/*
* hw_release() calls jpeg_deinit() which issues HW_STOP and waits for
* the STOP_ACK interrupt completion. It must be called outside
* dev_mutex to avoid a deadlock: the threaded IRQ handler acquires
* dev_mutex before signalling the completion.
*/
if (do_release)
hw->hw_release(ectx, q);
Since dev_mutex is explicitly dropped here, could a concurrent stream
acquisition via start_streaming() acquire dev_mutex and see the lockless
ref_count transition from 0 to 1, thus initializing the hardware and
enabling the IRQ?
If the preempted stop_streaming() path then resumes and executes
op_jpeg_release() in drivers/media/platform/qcom/jpeg/qcom_jenc_ops.c:
ref = atomic_dec_if_positive(&jenc->ref_count);
if (ref < 0) {
WARN_ON_ONCE(1);
return 0;
}
if (!ref) {
rc = jpeg_deinit(jenc);
// ...
disable_irq(jenc->irq);
could this destroy the hardware state and disable interrupts for the newly
active stream, potentially leading to deadlocks or panics from unclocked
register access?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260728082548.2511694-1-atanas.filipov@oss.qualcomm.com?part=3
prev parent reply other threads:[~2026-07-28 8:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 8:25 [PATCH v5 0/3] Add Qualcomm JPEG V4L2 encoder for SM8250 Atanas Filipov
2026-07-28 8:25 ` [PATCH v5 1/3] dt-bindings: media: qcom: Add JPEG encoder binding Atanas Filipov
2026-07-28 8:33 ` sashiko-bot
2026-07-28 9:12 ` Bryan O'Donoghue
2026-07-28 9:28 ` Atanas Filipov
2026-07-28 9:18 ` Loic Poulain
2026-07-28 9:49 ` Atanas Filipov
2026-07-28 8:25 ` [PATCH v5 2/3] media: qcom: jpeg: Add Qualcomm JPEG V4L2 encoder Atanas Filipov
2026-07-28 8:40 ` sashiko-bot
2026-07-28 8:25 ` [PATCH v5 3/3] arm64: dts: qcom: sm8250: Add JPEG encoder node Atanas Filipov
2026-07-28 8:39 ` sashiko-bot [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=20260728083924.B01971F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=atanas.filipov@oss.qualcomm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=media-ci@linuxtv.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.