Re: [PATCH] crypto: ccp: Fix SNP range list bounds check

From: Tycho Andersen

Date: Fri Jun 12 2026 - 11:19:18 EST


On Fri, Jun 12, 2026 at 05:25:25PM +0800, ZongYao.Chen@xxxxxxxxxxxxxxxxx wrote:
> From: Zongyao Chen <ZongYao.Chen@xxxxxxxxxxxxxxxxx>
>
> snp_filter_reserved_mem_regions() checks the range list size before
> adding a new entry. If the page-sized SNP_INIT_EX buffer is already
> full, the next matching resource can still write one entry past the end
> of the buffer.
>
> Check that there is room for the next entry before appending it, and
> compute the next entry pointer only after the bounds check.

> Fixes: 1ca5614b84ee ("crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Zongyao Chen <ZongYao.Chen@xxxxxxxxxxxxxxxxx>

I believe there is a version of this in the crypto tree already as
1b864b6cb213 ("crypto: ccp - Fix snp_filter_reserved_mem_regions()
off-by-one").

Thanks,

Tycho