From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, "Horia Geantă" <horia.geanta@nxp.com>,
"Pankaj Gupta" <pankaj.gupta@nxp.com>,
"Sahil Malhotra" <sahil.malhotra@nxp.com>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"Steffen Trumtrar" <kernel@pengutronix.de>,
"Meenakshi Aggarwal" <meenakshi.aggarwal@nxp.com>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 01/10] crypto: caam - Fix descriptor buffer overflow in caam_process_blob()
Date: Mon, 23 Nov 2026 15:09:52 +0000 [thread overview]
Message-ID: <20261123151055.2533735-2-lee@kernel.org> (raw)
In-Reply-To: <20261123151055.2533735-1-lee@kernel.org>
Commit a703a4c2a328 ("KEYS: trusted: caam based protected key") switched
caam_process_blob() from append_seq_in_ptr_intlen() and
append_seq_out_ptr_intlen() to append_seq_in_ptr() and
append_seq_out_ptr(), each of which emits an extra 32-bit extended
length word, and added append_key(), append_fifo_store(), and
append_jump() when encapsulating a protected key.
However, CAAM_BLOB_DESC_BYTES_MAX was not updated and still reserves
only 44 or 52 bytes (for 32-bit or 64-bit DMA addresses), whereas
caam_process_blob() now writes up to 60 bytes for standard blobs on
64-bit DMA platforms and up to 72 or 88 bytes when encapsulating a
protected key, overflowing the kzalloc()-allocated job descriptor
buffer into adjacent slab memory.
Update CAAM_BLOB_DESC_BYTES_MAX to account for the protected-key
commands and the extended sequence pointer length words.
Fixes: a703a4c2a328 ("KEYS: trusted: caam based protected key")
Closes: https://sashiko.dev/#/bug/linux-fd968875-61a8-4100-ba0c-b9cd164d86e8
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/crypto/caam/blob_gen.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/crypto/caam/blob_gen.c b/drivers/crypto/caam/blob_gen.c
index c18dbac56493..b4fdc15dd0b6 100644
--- a/drivers/crypto/caam/blob_gen.c
+++ b/drivers/crypto/caam/blob_gen.c
@@ -23,12 +23,16 @@
#define CAAM_BLOB_DESC_BYTES_MAX \
/* Command to initialize & stating length of descriptor */ \
(CAAM_CMD_SZ + \
+ /* Commands to load plain key, store protected key and jump */ \
+ CAAM_CMD_SZ + CAAM_PTR_SZ_MAX + \
+ CAAM_CMD_SZ + CAAM_PTR_SZ_MAX + \
+ CAAM_CMD_SZ + \
/* Command to append the key-modifier + key-modifier data */ \
CAAM_CMD_SZ + CAAM_BLOB_KEYMOD_LENGTH + \
- /* Command to include input key + pointer to the input key */ \
- CAAM_CMD_SZ + CAAM_PTR_SZ_MAX + \
- /* Command to include output key + pointer to the output key */ \
- CAAM_CMD_SZ + CAAM_PTR_SZ_MAX + \
+ /* Command to include input key + pointer and length */ \
+ 2 * CAAM_CMD_SZ + CAAM_PTR_SZ_MAX + \
+ /* Command to include output key + pointer and length */ \
+ 2 * CAAM_CMD_SZ + CAAM_PTR_SZ_MAX + \
/* Command describing the operation to perform */ \
CAAM_CMD_SZ)
--
2.56.1.750.gf70dc682cf-goog
next prev parent reply other threads:[~2026-11-23 15:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 15:09 [PATCH 00/10] crypto: Assorted bug fixes across crypto drivers Lee Jones
2026-11-23 15:09 ` Lee Jones [this message]
2026-11-30 10:26 ` [PATCH 01/10] crypto: caam - Fix descriptor buffer overflow in caam_process_blob() Sahil Malhotra
2026-11-30 14:38 ` Lee Jones
2026-11-23 15:09 ` [PATCH 02/10] crypto: marvell - Fix AEAD key buffer overflow for SHA-384/512 HMAC Lee Jones
2026-11-23 15:09 ` [PATCH 03/10] crypto: nx - Fix bounce buffer copy overflow in decompress() Lee Jones
2026-11-23 15:37 ` sashiko-bot
2026-11-23 15:09 ` [PATCH 04/10] crypto: sun8i-ss - Fix scatterlist array overflow for HMAC requests Lee Jones
2026-11-23 15:09 ` [PATCH 05/10] crypto: hisilicon/hpre - Fix buffer overflow on odd ECDH input size Lee Jones
2026-11-24 7:39 ` liulongfang
2026-11-23 15:09 ` [PATCH 06/10] crypto: talitos - Remove duplicate IV unmap in AEAD encrypt path Lee Jones
2026-11-23 15:19 ` sashiko-bot
2026-11-23 15:09 ` [PATCH 07/10] crypto: safexcel - Check scatterlist errors before max() for in-place Lee Jones
2026-11-26 16:47 ` Antoine Tenart
2026-11-23 15:09 ` [PATCH 08/10] crypto: qce - Pass mapped scatterlist count to qce_dma_prep_sgs() Lee Jones
2026-11-24 12:49 ` Bartosz Golaszewski
2026-11-23 15:10 ` [PATCH 09/10] crypto: qce - Terminate RX DMA channel if TX preparation fails Lee Jones
2026-11-24 12:49 ` Bartosz Golaszewski
2026-11-23 15:10 ` [PATCH 10/10] crypto: atmel-tdes - Update output IV before clearing busy flag Lee Jones
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=20261123151055.2533735-2-lee@kernel.org \
--to=lee@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=meenakshi.aggarwal@nxp.com \
--cc=pankaj.gupta@nxp.com \
--cc=sahil.malhotra@nxp.com \
--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.