Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pavitrakumar Managutte" <pavitrakumarm@vayavyalabs.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v18 3/4] crypto: spacc - Add SPAcc AUTODETECT Support
Date: Thu, 23 Jul 2026 12:19:35 +0000	[thread overview]
Message-ID: <20260723121939.699381F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260723120156.285270-4-pavitrakumarm@vayavyalabs.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unkillable wait during hardware autodetection can permanently hang the kernel if the device drops unsupported jobs.
--

--- Patch [3]: [PATCH v18 3/4] crypto: spacc - Add SPAcc AUTODETECT Support ---
commit 9e2e636bd5aacb282e1058d2b08e95919016a954
Author: Pavitrakumar Managutte <pavitrakumarm@vayavyalabs.com>

crypto: spacc - Add SPAcc AUTODETECT Support

This commit adds hardware autodetect support to the SPAcc crypto driver.
It iterates through multiple cryptographic algorithms and submits test jobs
to determine if the hardware supports them.

> diff --git a/drivers/crypto/dwc-spacc/spacc_core.c b/drivers/crypto/dwc-spacc/spacc_core.c
> index 36ab428301867..b6ed04d936dba 100644
> --- a/drivers/crypto/dwc-spacc/spacc_core.c
> +++ b/drivers/crypto/dwc-spacc/spacc_core.c

[ ... ]

> +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]
Could this wait_event call permanently hang the kernel during initialization?

If the hardware silently drops a command for an unsupported algorithm instead
of completing it with an explicit error status, no interrupt will be raised.

Since autodetection inherently tests invalid or unsupported states, using
wait_event without a timeout could cause the boot or driver probe path to hang
indefinitely in an uninterruptible state.

Could a timeout like wait_event_timeout be used here instead, and perhaps
handle the hardware failure gracefully (e.g. by resetting the hardware or
quarantining the test DMA buffer) rather than intentionally hanging the system?

> +
> +		job->job_done = 0;
> +		err = job->job_err;
> +	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260723120156.285270-1-pavitrakumarm@vayavyalabs.com?part=3

  reply	other threads:[~2026-07-23 12:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 12:01 [PATCH v18 0/4] crypto: spacc - Add SPAcc Crypto Driver Pavitrakumar Managutte
2026-07-23 12:01 ` [PATCH v18 1/4] dt-bindings: crypto: Document support for SPAcc Pavitrakumar Managutte
2026-07-23 12:01 ` [PATCH v18 2/4] crypto: spacc - Add SPAcc ahash support Pavitrakumar Managutte
2026-07-23 12:24   ` sashiko-bot
2026-07-23 12:01 ` [PATCH v18 3/4] crypto: spacc - Add SPAcc AUTODETECT Support Pavitrakumar Managutte
2026-07-23 12:19   ` sashiko-bot [this message]
2026-07-23 12:01 ` [PATCH v18 4/4] crypto: spacc - Add SPAcc Kconfig and Makefile Pavitrakumar Managutte
2026-07-23 12:14   ` sashiko-bot

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=20260723121939.699381F000E9@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