From: sashiko-bot@kernel.org
To: "Pavitrakumar Managutte" <pavitrakumarm@vayavyalabs.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v16 3/4] crypto: spacc - Add SPAcc AUTODETECT Support
Date: Tue, 07 Jul 2026 13:09:29 +0000 [thread overview]
Message-ID: <20260707130929.E85091F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260707125311.2398031-4-pavitrakumarm@vayavyalabs.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Critical] Missing hardware job cancellation on timeout or interrupt during SPAcc autodetect causes DMA use-after-free, stack use-after-free, and data corruption.
- [High] Abandoned jobs from autodetect cause `spacc_pop_packets_ex` to abort, hanging the STAT FIFO and blocking subsequent jobs.
- [Medium] Autodetect test vector failures do not fully clear the 'hash flag' or override specific ciphers, causing broken algorithms to be falsely registered.
--
--- Patch [3]: [PATCH v16 3/4] crypto: spacc - Add SPAcc AUTODETECT Support ---
commit ecbce57497637f8381b32aed9f07d6c23e608ed7
Author: Pavitrakumar Managutte <pavitrakumarm@vayavyalabs.com>
crypto: spacc - Add SPAcc AUTODETECT Support
This commit introduces an autodetect configuration mode for the SPAcc
crypto driver to dynamically discover supported algorithms.
> diff --git a/drivers/crypto/dwc-spacc/spacc_core.c b/drivers/crypto/dwc-spacc/spacc_core.c
> --- a/drivers/crypto/dwc-spacc/spacc_core.c
> +++ b/drivers/crypto/dwc-spacc/spacc_core.c
[ ... ]
> + if (err == 0) {
> + long ret;
> +
> + ret = wait_event_interruptible_timeout(job->waitq,
> + job->job_done,
> + msecs_to_jiffies(SPACC_AUTODETECT_TIMEOUT_MS));
> + if (ret == 0) {
> + /* no response; caller disables the whole mode */
> + spacc_close(spacc, rc);
> + return -ETIMEDOUT;
[Severity: High]
When a job times out, it is abandoned and spacc_close() marks its slot as
SPACC_JOB_IDX_UNUSED. If the hardware eventually completes this abandoned job
and the STAT IRQ fires, will spacc_pop_packets_ex() encounter this unused
slot, execute goto ERR, and skip processing the rest of the completed jobs
in the STAT FIFO? Could this cause remaining jobs to get permanently stuck?
> + } else if (ret == -ERESTARTSYS) {
> + /* load interrupted; caller aborts and fails probe */
> + spacc_close(spacc, rc);
> + return -EINTR;
[Severity: Critical]
If the wait is interrupted (e.g. via a signal) or times out, the software
state is closed and the DMA buffers are immediately freed by the caller in
spacc_autodetect().
Because the hardware crypto engine is not explicitly instructed to abort
the job during spacc_close(), will it continue executing and asynchronously
write its result to the newly freed DMA memory?
> + }
> +
> + job->job_done = 0;
> + err = job->job_err;
> + }
> +
> + output_zero_len = !testdata[algo_mode].test[keysz_idx].outlen;
> + output_mismatch = memcmp(testdata[algo_mode].test[keysz_idx].data, virt,
> + testdata[algo_mode].test[keysz_idx].outlen);
> +
> + if (err != 0 || output_zero_len || output_mismatch)
> + spacc->config.modes[algo_mode] &= ~(1 << keysz_idx);
[Severity: Medium]
When an autodetect test fails, this bitwise operation only clears the
specific keysize bits (0-6). Does this leave bit 7 (the hash flag, 128)
set?
If bit 7 remains set, or if the algorithm uses a hardcoded check like
CRYPTO_MODE_AES_XTS, will spacc_is_mode_keysize_supported() bypass this
failure and falsely register algorithms that the hardware does not support?
> +
> + spacc_close(spacc, rc);
> +
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260707125311.2398031-1-pavitrakumarm@vayavyalabs.com?part=3
next prev parent reply other threads:[~2026-07-07 13:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 12:53 [PATCH v16 0/4] crypto: spacc - Add SPAcc Crypto Driver Pavitrakumar Managutte
2026-07-07 12:53 ` [PATCH v16 1/4] dt-bindings: crypto: Document support for SPAcc Pavitrakumar Managutte
2026-07-07 12:53 ` [PATCH v16 2/4] crypto: spacc - Add SPAcc ahash support Pavitrakumar Managutte
2026-07-07 13:13 ` sashiko-bot
2026-07-07 12:53 ` [PATCH v16 3/4] crypto: spacc - Add SPAcc AUTODETECT Support Pavitrakumar Managutte
2026-07-07 13:09 ` sashiko-bot [this message]
2026-07-07 12:53 ` [PATCH v16 4/4] crypto: spacc - Add SPAcc Kconfig and Makefile Pavitrakumar Managutte
2026-07-07 13:06 ` sashiko-bot
2026-07-10 12:27 ` Julian Braha
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=20260707130929.E85091F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox