Re: [PATCH 01/10] crypto: caam - Fix descriptor buffer overflow in caam_process_blob()
From: Lee Jones
Date: Mon Nov 30 2026 - 09:38:53 EST
On Mon, 30 Nov 2026, Sahil Malhotra wrote:
> On Mon, Nov 23, 2026 at 03:09:52PM +0000, Lee Jones wrote:
> > 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.
>
> Hi Lee,
>
> Thanks for the patch.
>
> The analysis is correct, and the new macro covers the worst case of the
> current code.
>
> Keisuke Tsukuda has posted a fix for the same overflow:
>
> https://lore.kernel.org/linux-crypto/20261124002830.35444-1-tkdkei@xxxxxxxxxx/
>
> It drops CAAM_BLOB_DESC_BYTES_MAX and allocates CAAM_DESC_BYTES_MAX,
> the hardware limit for a job descriptor. I would prefer that approach.
> The overflow came from the hand-written size falling out of sync with
> the descriptor code, and a fixed maximum avoids the same problem the
> next time a command is added.
>
> Only one of the two should go in. Unless Herbert prefers this version,
> please drop this patch from the series and let Keisuke's go in.
No problem.
--
Lee Jones