From: sashiko-bot@kernel.org
To: "Saravanakrishnan Krishnamoorthy" <skrishnamoorthy@rambus.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 11/19] crypto: cmh - add DRBG hwrng
Date: Thu, 06 Aug 2026 20:17:25 +0000 [thread overview]
Message-ID: <20260806201726.5E5551F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260806195519.2703224-12-skrishnamoorthy@rambus.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Returning 0 on immediate transient or fatal errors during a blocking read causes a tight CPU loop in the hwrng core.
--
--- Patch [11]: [PATCH v3 11/19] crypto: cmh - add DRBG hwrng ---
commit 8691568ae77b559cf0523f037da202d7654311a0
Author: Alex Ousherovitch <aousherovitch@rambus.com>
crypto: cmh - add DRBG hwrng
This commit registers the CMH DRBG core as a hardware RNG provider. It
implements a read callback that submits requests to the hardware
transaction manager.
> diff --git a/drivers/crypto/cmh/cmh_rng.c b/drivers/crypto/cmh/cmh_rng.c
> new file mode 100644
> index 0000000000000..9532b8d66b4c5
> --- /dev/null
> +++ b/drivers/crypto/cmh/cmh_rng.c
[ ... ]
> +static int cmh_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
> +{
[ ... ]
> + ret = cmh_tm_submit_sync_noabort(vcq, DRBG_READ_VCQ_CMDS, 1,
> + msecs_to_jiffies(drbg_timeout_ms),
> + cmh_dma_orphan_free, orphan);
[ ... ]
> + if (ret) {
> + /*
> + * .read() only runs with wait=true (see the !wait early
> + * return above). For known transient conditions return 0 so
> + * the hwrng core retries the blocking read; a negative errno
> + * here would be forwarded to userspace on a blocking fd
> + * (e.g. -EAGAIN violates POSIX). Propagate genuinely
> + * unexpected failures so real faults are not masked into an
> + * indefinite retry loop.
> + */
> + switch (ret) {
> + case -EAGAIN:
> + case -EBUSY:
> + case -ETIMEDOUT:
> + case -EIO:
> + /*
> + * -ENODEV: the TM is not running -- occurs when the
> + * hwrng kthread (PF_NOFREEZE, not frozen during
> + * suspend) calls .read() while the device is suspended.
> + * Treat as transient: the TM restarts on resume.
> + */
> + case -ENODEV:
> + dev_dbg_ratelimited(cmh_dev(),
> + "rng: transient DRBG failure (rc=%d)\n",
> + ret);
> + kfree_sensitive(dmabuf);
> + return 0;
[Severity: High]
If the hardware transaction manager is suspended (-ENODEV) or the command
queue is full (-EAGAIN), cmh_tm_submit_sync_noabort() returns the error
immediately and this code returns 0.
For a blocking read (wait == true), won't the hwrng core receive 0 and loop
without sleeping? This appears to create a tight kernel-space loop that
repeatedly holds and releases the reading_mutex, hogging the CPU until the
transient condition resolves.
> + default:
> + dev_err_ratelimited(cmh_dev(),
> + "rng: DRBG generate failed (rc=%d)\n",
> + ret);
> + kfree_sensitive(dmabuf);
> + return ret;
> + }
> + }
> +
> + memcpy(data, dmabuf, nbytes);
> + kfree_sensitive(dmabuf);
> +
> + return nbytes;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260806195519.2703224-1-skrishnamoorthy@rambus.com?part=11
next prev parent reply other threads:[~2026-08-06 20:17 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 19:54 [PATCH v3 00/19] crypto: cmh - add Rambus CryptoManager Hub driver Saravanakrishnan Krishnamoorthy
2026-08-06 19:54 ` Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` [PATCH v3 01/19] dt-bindings: crypto: add Rambus CryptoManager Hub Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:01 ` sashiko-bot
2026-08-10 8:16 ` Krzysztof Kozlowski
2026-08-10 8:16 ` Krzysztof Kozlowski
2026-08-11 8:32 ` Krzysztof Kozlowski
2026-08-11 8:32 ` Krzysztof Kozlowski
2026-08-11 16:49 ` Ousherovitch, Alex
2026-08-11 16:49 ` Ousherovitch, Alex
2026-08-06 19:55 ` [PATCH v3 02/19] crypto: cmh - add core platform driver Saravanakrishnan Krishnamoorthy
2026-08-06 20:11 ` sashiko-bot
2026-08-11 8:31 ` Krzysztof Kozlowski
2026-08-11 8:31 ` Krzysztof Kozlowski
2026-08-11 18:19 ` Ousherovitch, Alex
2026-08-11 18:19 ` Ousherovitch, Alex
2026-08-11 8:36 ` Krzysztof Kozlowski
2026-08-11 8:36 ` Krzysztof Kozlowski
2026-08-11 18:20 ` Ousherovitch, Alex
2026-08-11 18:20 ` Ousherovitch, Alex
2026-08-06 19:55 ` [PATCH v3 03/19] crypto: cmh - add key provisioning and management Saravanakrishnan Krishnamoorthy
2026-08-06 20:17 ` sashiko-bot
2026-08-11 8:33 ` Krzysztof Kozlowski
2026-08-11 8:33 ` Krzysztof Kozlowski
2026-08-11 18:22 ` Ousherovitch, Alex
2026-08-11 18:22 ` Ousherovitch, Alex
2026-08-06 19:55 ` [PATCH v3 04/19] crypto: cmh - add SHA-2/SHA-3/SHAKE ahash Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:12 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 05/19] crypto: cmh - add HMAC ahash Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:09 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 06/19] crypto: cmh - add CSHAKE/KMAC ahash Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:10 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 07/19] crypto: cmh - add SM3 ahash Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:07 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 08/19] crypto: cmh - add AES skcipher/aead/cmac Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:10 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 09/19] crypto: cmh - add SM4 skcipher/aead/cmac/xcbc Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:09 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 10/19] crypto: cmh - add ChaCha20-Poly1305 Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:12 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 11/19] crypto: cmh - add DRBG hwrng Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:17 ` sashiko-bot [this message]
2026-08-11 8:38 ` Krzysztof Kozlowski
2026-08-11 8:38 ` Krzysztof Kozlowski
2026-08-11 18:23 ` Ousherovitch, Alex
2026-08-11 18:23 ` Ousherovitch, Alex
2026-08-06 19:55 ` [PATCH v3 12/19] crypto: cmh - add RSA akcipher Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:18 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 13/19] crypto: cmh - add ECDSA/SM2 sig Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:24 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 14/19] crypto: cmh - add ECDH/X25519 kpp Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:34 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 15/19] crypto: cmh - add ML-KEM/ML-DSA (QSE) Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:24 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 16/19] crypto: cmh - add SLH-DSA/LMS/XMSS (HCQ) Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:43 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 17/19] Documentation: ioctl: add CMH ioctl documentation and register 'J' Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 20:25 ` sashiko-bot
2026-08-06 19:55 ` [PATCH v3 18/19] selftests: crypto: cmh - add kselftest for management ioctl Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` [PATCH v3 19/19] MAINTAINERS: add Rambus CryptoManager Hub (CMH) Saravanakrishnan Krishnamoorthy
2026-08-06 19:55 ` Saravanakrishnan Krishnamoorthy
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=20260806201726.5E5551F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=skrishnamoorthy@rambus.com \
/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.