All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: linux-crypto@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	James Hsiao <jhsiao@amcc.com>, Rosen Penev <rosenp@gmail.com>,
	Christian Lamparter <chunkeey@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH 1/8] crypto: amcc - fix scatter ring full check
Date: Thu, 26 Nov 2026 20:04:16 -0800	[thread overview]
Message-ID: <20261127040423.1023233-2-rosenp@gmail.com> (raw)
In-Reply-To: <20261127040423.1023233-1-rosenp@gmail.com>

crypto4xx_get_n_sd() compares the scatter ring head with the gather
ring tail (gdr_tail) instead of the scatter ring tail. When
sdr_head > sdr_tail but sdr_head <= gdr_tail, neither branch of the
full check runs, and the allocation is granted even if it wraps over
scatter descriptors that are still in use.

On an APM82181 (Meraki MX60), a stress test that keeps many
out-of-place requests in flight stalls the engine with this: the
engine stops at a packet descriptor that has HOST_READY set, no further
interrupts arrive, and every later request hangs. With the check fixed,
the same test runs to completion.

Compare with sdr_tail.

Fixes: 049359d65527 ("crypto: amcc - Add crypt4xx driver")
Cc: stable@vger.kernel.org
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/crypto/amcc/crypto4xx_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index acf18b71e54d..7a1ababd9198 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -402,7 +402,7 @@ static u32 crypto4xx_get_n_sd(struct crypto4xx_device *dev, int n)
 
 	retval = dev->sdr_head;
 	tmp = (dev->sdr_head + n) % PPC4XX_NUM_SD;
-	if (dev->sdr_head > dev->gdr_tail) {
+	if (dev->sdr_head > dev->sdr_tail) {
 		if (tmp < dev->sdr_head && tmp >= dev->sdr_tail)
 			return ERING_WAS_FULL;
 	} else if (dev->sdr_head < dev->sdr_tail) {
-- 
2.56.1


  reply	other threads:[~2026-11-27  4:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  4:04 [PATCH 0/8] crypto: amcc - fixes for the crypto4xx driver Rosen Penev
2026-11-27  4:04 ` Rosen Penev [this message]
2026-11-27  4:04 ` [PATCH 2/8] crypto: amcc - fix missing DMA memory barriers in descriptor handling Rosen Penev
2026-11-27  4:04 ` [PATCH 3/8] crypto: amcc - allocate all algorithm wrappers before registering Rosen Penev
2026-11-27  4:04 ` [PATCH 4/8] crypto: amcc - set up the TRNG before registering the algorithms Rosen Penev
2026-11-27  4:04 ` [PATCH 5/8] crypto: amcc - don't use memcpy() on the coherent SA and state record Rosen Penev
2026-11-27  4:04 ` [PATCH 6/8] crypto: amcc - fix the DMA mappings of the source and destination Rosen Penev
2026-11-27  4:04 ` [PATCH 7/8] crypto: amcc - fix the inverted AEAD error ratelimit Rosen Penev
2026-11-27  4:04 ` [PATCH 8/8] crypto: amcc - wipe the SA key material when freeing it Rosen Penev

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=20261127040423.1023233-2-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=chunkeey@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jhsiao@amcc.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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.