* [PATCH 00/10] crypto: Assorted bug fixes across crypto drivers
@ 2026-11-23 15:09 Lee Jones
2026-11-23 15:09 ` [PATCH 04/10] crypto: sun8i-ss - Fix scatterlist array overflow for HMAC requests Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Lee Jones @ 2026-11-23 15:09 UTC (permalink / raw)
To: lee
Cc: linux-kernel, Christophe Leroy (CS GROUP), David S. Miller,
Horia Geantă, Ritesh Harjani (IBM), Aleksander Jan Bajkowski,
Alexandre Belloni, Antoine Tenart, Bartosz Golaszewski,
Bharat Bhushan, bui duc phuc, Bulent Abali, Chen-Yu Tsai,
Claudiu Beznea, Corentin Labbe, Dan Streetman, Evgeniy Polyakov,
Haren Myneni, Herbert Xu, Jernej Skrabec, Kim Phillips,
linux-arm-kernel, linux-arm-msm, linux-crypto, linux-sunxi,
linuxppc-dev, Longfang Liu, Madhavan Srinivasan,
Meenakshi Aggarwal, Meng Yu, Michael Ellerman, Nicholas Piggin,
Nicolas Ferre, Nicolas Royer, Pankaj Gupta, Pascal van Leeuwen,
Paul Louvel, Robert Jennings, Sahil Malhotra, Samuel Holland,
Seth Jennings, Shrikanth Hegde, Srujana Challa, Stanimir Varbanov,
Steffen Trumtrar, Thorsten Blum, Tudor Ambarus, Weili Qian,
Zaibo Xu, Zhiqi Song
These issues were reported by Sashiko.
None of these changes have been tested on physical hardware.
Cc: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "Horia Geantă" <horia.geanta@nxp.com>
Cc: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Cc: Aleksander Jan Bajkowski <olek2@wp.pl>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Antoine Tenart <atenart@kernel.org>
Cc: Bartosz Golaszewski <brgl@kernel.org>
Cc: Bharat Bhushan <bbhushan2@marvell.com>
Cc: bui duc phuc <phucduc.bui@gmail.com>
Cc: Bulent Abali <abali@us.ibm.com>
Cc: Chen-Yu Tsai <wens@kernel.org>
Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: Corentin Labbe <clabbe.montjoie@gmail.com>
Cc: Dan Streetman <ddstreet@ieee.org>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Haren Myneni <haren@us.ibm.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Kim Phillips <kim.phillips@freescale.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-crypto@vger.kernel.org
Cc: linux-sunxi@lists.linux.dev
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Longfang Liu <liulongfang@huawei.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Cc: Meng Yu <yumeng18@huawei.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Nicolas Royer <nicolas@eukrea.com>
Cc: Pankaj Gupta <pankaj.gupta@nxp.com>
Cc: Pascal van Leeuwen <pvanleeuwen@insidesecure.com>
Cc: Paul Louvel <paul.louvel@bootlin.com>
Cc: Robert Jennings <rcj@linux.vnet.ibm.com>
Cc: Sahil Malhotra <sahil.malhotra@nxp.com>
Cc: Samuel Holland <samuel@sholland.org>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Srujana Challa <schalla@marvell.com>
Cc: Stanimir Varbanov <svarbanov@mm-sol.com>
Cc: Steffen Trumtrar <kernel@pengutronix.de>
Cc: Thorsten Blum <blum@kernel.org>
Cc: Tudor Ambarus <tudor.ambarus@linaro.org>
Cc: Weili Qian <qianweili@huawei.com>
Cc: Zaibo Xu <xuzaibo@huawei.com>
Cc: Zhiqi Song <songzhiqi1@huawei.com>
Lee Jones (10):
crypto: caam - Fix descriptor buffer overflow in caam_process_blob()
crypto: marvell - Fix AEAD key buffer overflow for SHA-384/512 HMAC
crypto: nx - Fix bounce buffer copy overflow in decompress()
crypto: sun8i-ss - Fix scatterlist array overflow for HMAC requests
crypto: hisilicon/hpre - Fix buffer overflow on odd ECDH input size
crypto: talitos - Remove duplicate IV unmap in AEAD encrypt path
crypto: safexcel - Check scatterlist errors before max() for in-place
crypto: qce - Pass mapped scatterlist count to qce_dma_prep_sgs()
crypto: qce - Terminate RX DMA channel if TX preparation fails
crypto: atmel-tdes - Update output IV before clearing busy flag
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 7 +++++--
drivers/crypto/atmel-tdes.c | 7 +++++--
drivers/crypto/caam/blob_gen.c | 12 ++++++++----
drivers/crypto/hisilicon/hpre/hpre_crypto.c | 5 +++--
drivers/crypto/inside-secure/safexcel_cipher.c | 7 +++----
drivers/crypto/marvell/octeontx/otx_cptvf_algs.h | 2 +-
drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.h | 2 +-
drivers/crypto/nx/nx-842.c | 5 ++++-
drivers/crypto/qce/dma.c | 8 ++++++--
drivers/crypto/qce/sha.c | 9 +++++----
drivers/crypto/talitos.c | 4 ----
11 files changed, 41 insertions(+), 27 deletions(-)
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 04/10] crypto: sun8i-ss - Fix scatterlist array overflow for HMAC requests
2026-11-23 15:09 [PATCH 00/10] crypto: Assorted bug fixes across crypto drivers Lee Jones
@ 2026-11-23 15:09 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2026-11-23 15:09 UTC (permalink / raw)
To: lee, Corentin Labbe, Herbert Xu, David S. Miller, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, bui duc phuc, linux-crypto,
linux-arm-kernel, linux-sunxi, linux-kernel
Cc: stable
sun8i_ss_hash_need_fallback() reserves one hardware scatterlist slot
out of MAX_SG (8) for the trailing hash padding buffer, allowing up to
7 input scatterlist entries.
However, for HMAC requests (tfmctx->keylen > 0), sun8i_ss_hash_run()
also shifts the mapped source array up by one slot to insert the inner
pad at index 0 and increments i before writing the trailing padding
entry at rctx->t_src[i] and rctx->t_dst[i]. When an HMAC request
contains 7 block-aligned scatterlist entries, i reaches 8 (MAX_SG),
writing past the end of rctx->t_src and rctx->t_dst, corrupting
rctx->method and rctx->flow, and indexing out of bounds into ss->flows.
Reserve an extra scatterlist slot in sun8i_ss_hash_need_fallback() when
tfmctx->keylen is non-zero so 7-entry HMAC requests use the software
fallback.
Fixes: 801b7d572c0a ("crypto: sun8i-ss - add hmac(sha1)")
Closes: https://sashiko.dev/#/bug/linux-93388c71-507c-42fd-9c86-8076b06fc7c0
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c
index 56ba4ff6d5ff..c2e0c6520f84 100644
--- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c
+++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c
@@ -344,9 +344,11 @@ static int sun8i_ss_run_hash_task(struct sun8i_ss_dev *ss,
static bool sun8i_ss_hash_need_fallback(struct ahash_request *areq)
{
struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
+ struct sun8i_ss_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm);
struct ahash_alg *alg = crypto_ahash_alg(tfm);
struct sun8i_ss_alg_template *algt;
struct scatterlist *sg;
+ int max_sg;
algt = container_of(alg, struct sun8i_ss_alg_template, alg.hash.base);
@@ -360,8 +362,9 @@ static bool sun8i_ss_hash_need_fallback(struct ahash_request *areq)
return true;
}
- /* we need to reserve one SG for the padding one */
- if (sg_nents(areq->src) > MAX_SG - 1) {
+ /* Reserve one SG for padding and, for HMAC, one for ipad */
+ max_sg = tfmctx->keylen ? MAX_SG - 2 : MAX_SG - 1;
+ if (sg_nents(areq->src) > max_sg) {
algt->stat_fb_sgnum++;
return true;
}
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 15:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 15:09 [PATCH 00/10] crypto: Assorted bug fixes across crypto drivers Lee Jones
2026-11-23 15:09 ` [PATCH 04/10] crypto: sun8i-ss - Fix scatterlist array overflow for HMAC requests Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox