]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: ccp - Avoid page allocation failure warning for SEV_GET_ID2
authorDavid Rientjes <rientjes@google.com>
Fri, 30 Dec 2022 22:18:46 +0000 (14:18 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:32:52 +0000 (09:32 +0100)
commit02c56040f14fcc3e1aa8762a9fe6dd41c601390d
tree2062eb07a285068dde97ab7b58a42b0b5c0dcd41
parentd650bfc5cb35442cd47378c7dcb8eba8915fe564
crypto: ccp - Avoid page allocation failure warning for SEV_GET_ID2

[ Upstream commit a4a20fefe07309f3360845ca13211b6cc6aad961 ]

For SEV_GET_ID2, the user provided length does not have a specified
limitation because the length of the ID may change in the future.  The
kernel memory allocation, however, is implicitly limited to 4MB on x86 by
the page allocator, otherwise the kzalloc() will fail.

When this happens, it is best not to spam the kernel log with the warning.
Simply fail the allocation and return ENOMEM to the user.

Fixes: 7d79c4402d1d ("crypto: ccp - introduce SEV_GET_ID2 command")
Reported-by: Andy Nguyen <theflow@google.com>
Reported-by: Peter Gonda <pgonda@google.com>
Suggested-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David Rientjes <rientjes@google.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/ccp/sev-dev.c