From: sashiko-bot@kernel.org
To: "Pavitrakumar Managutte" <pavitrakumarm@vayavyalabs.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v22 3/4] crypto: spacc - add spacc autodetect support
Date: Wed, 12 Aug 2026 18:05:00 +0000 [thread overview]
Message-ID: <20260812180500.A68871F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260812175020.666558-4-pavitrakumarm@vayavyalabs.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unkillable wait without a timeout in hardware autodetection can permanently hang the kernel.
--
--- Patch [3]: [PATCH v22 3/4] crypto: spacc - add spacc autodetect support ---
commit 1b02ffd964af3b1927d2fca1ccd5966f8d928e2e
Author: Pavitrakumar Managutte <pavitrakumarm@vayavyalabs.com>
crypto: spacc - add spacc autodetect support
This commit adds autodetection support to the SPAcc driver to determine
supported cryptographic algorithms. It runs test vectors through the hardware
during initialization and disables algorithms that fail to produce the
expected output.
> diff --git a/drivers/crypto/dwc-spacc/spacc_core.c b/drivers/crypto/dwc-spacc/spacc_core.c
> index b72d5072ccc58..3287e9e61b1c0 100644
> --- a/drivers/crypto/dwc-spacc/spacc_core.c
> +++ b/drivers/crypto/dwc-spacc/spacc_core.c
[ ... ]
> @@ -579,6 +1480,275 @@ int spacc_close(struct spacc_device *dev, int handle)
[ ... ]
> +#if IS_ENABLED(CONFIG_CRYPTO_DEV_SPACC_AUTODETECT)
[ ... ]
> +static int spacc_check_modes(struct spacc_device *spacc, int algo_mode,
> + int keysz_idx, void *virt, char *key,
> + struct pdu_ddt *ddt)
> +{
[ ... ]
> + err = spacc_packet_enqueue_ddt(spacc, rc, ddt, ddt, proclen, 0,
> + aadlen, 0, 0, 0);
> + job = &spacc->job[rc];
> +
> + if (err == 0) {
> + /*
> + * No timeout, not interruptible: this only returns once
> + * job_done is actually true, i.e. the hardware has
> + * genuinely relinquished the job. That guarantees it is
> + * always safe to close the job/context and (via the
> + * caller) free the DMA buffer immediately below --
> + * there is no "unconfirmed" case left to handle.
> + *
> + * Tradeoff: if the hardware ever genuinely fails to
> + * complete a submitted job, this hangs here
> + * unkillably (TASK_UNINTERRUPTIBLE, no timeout) for the
> + * rest of probe. Accepted deliberately in place of the
> + * abandoned-job/UAF risk of giving up early with no
> + * hardware cancel available.
> + */
> + wait_event(job->waitq, job->job_done);
[Severity: High]
Can this wait_event() cause a permanent kernel thread hang?
If the hardware fails to respond or trigger the completion interrupt, this
uninterruptible wait will never complete. If the driver is built-in and
probes synchronously, couldn't this stall the entire system boot process,
or otherwise result in hung task panics?
While the comment notes this as a deliberate tradeoff to avoid DMA
use-after-free risks upon abandoning the job, is it possible to implement a
safe hardware cancellation or reset path and use wait_event_timeout()
instead of relying on an unkillable wait?
> +
> + job->job_done = 0;
> + err = job->job_err;
> + }
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260812175020.666558-1-pavitrakumarm@vayavyalabs.com?part=3
next prev parent reply other threads:[~2026-08-12 18:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 17:50 [PATCH v22 0/4] crypto: spacc - Add SPAcc Crypto Driver Pavitrakumar Managutte
2026-08-12 17:50 ` [PATCH v22 1/4] dt-bindings: crypto: Document support for SPAcc Pavitrakumar Managutte
2026-08-12 17:50 ` [PATCH v22 2/4] crypto: spacc - Add SPAcc ahash support Pavitrakumar Managutte
2026-08-12 18:10 ` sashiko-bot
2026-08-12 17:50 ` [PATCH v22 3/4] crypto: spacc - add spacc autodetect support Pavitrakumar Managutte
2026-08-12 18:05 ` sashiko-bot [this message]
2026-08-12 17:50 ` [PATCH v22 4/4] crypto: spacc - Add SPAcc Kconfig and Makefile Pavitrakumar Managutte
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=20260812180500.A68871F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=pavitrakumarm@vayavyalabs.com \
--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.