[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YqMLUOQtcsNwU6xw@gondor.apana.org.au>
Date: Fri, 10 Jun 2022 17:13:52 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: John Allen <john.allen@....com>
Cc: linux-crypto@...r.kernel.org, seanjc@...gle.com,
Thomas.Lendacky@....com, Ashish.Kalra@....com,
linux-kernel@...r.kernel.org, theflow@...gle.com,
rientjes@...gle.com, pgonda@...gle.com, stable@...r.kernel.org
Subject: Re: [PATCH v4] crypto: ccp - Use kzalloc for sev ioctl interfaces to
prevent kernel memory leak
On Wed, May 18, 2022 at 03:31:26PM +0000, John Allen wrote:
> For some sev ioctl interfaces, input may be passed that is less than or
> equal to SEV_FW_BLOB_MAX_SIZE, but larger than the data that PSP
> firmware returns. In this case, kmalloc will allocate memory that is the
> size of the input rather than the size of the data. Since PSP firmware
> doesn't fully overwrite the buffer, the sev ioctl interfaces with the
> issue may return uninitialized slab memory.
>
> Currently, all of the ioctl interfaces in the ccp driver are safe, but
> to prevent future problems, change all ioctl interfaces that allocate
> memory with kmalloc to use kzalloc and memset the data buffer to zero
> in sev_ioctl_do_platform_status.
>
> Fixes: 38103671aad3 ("crypto: ccp: Use the stack and common buffer for status commands")
> Fixes: e799035609e15 ("crypto: ccp: Implement SEV_PEK_CSR ioctl command")
> Fixes: 76a2b524a4b1d ("crypto: ccp: Implement SEV_PDH_CERT_EXPORT ioctl command")
> Fixes: d6112ea0cb344 ("crypto: ccp - introduce SEV_GET_ID2 command")
> Cc: stable@...r.kernel.org
> Reported-by: Andy Nguyen <theflow@...gle.com>
> Suggested-by: David Rientjes <rientjes@...gle.com>
> Suggested-by: Peter Gonda <pgonda@...gle.com>
> Signed-off-by: John Allen <john.allen@....com>
> ---
> v2:
> - Add fixes tags and CC stable@...r.kernel.org
> v3:
> - memset data buffer to zero in sev_ioctl_do_platform_status
> v4:
> - Add fixes tag for sev_ioctl_do_platform_status change
> ---
> drivers/crypto/ccp/sev-dev.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists