Patch "crypto: ccp - Avoid page allocation failure warning for SEV_GET_ID2" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    crypto: ccp - Avoid page allocation failure warning for SEV_GET_ID2

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     crypto-ccp-avoid-page-allocation-failure-warning-for.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ce947a7ba44d2625f840f1169cefe671b255288e
Author: David Rientjes <rientjes@xxxxxxxxxx>
Date:   Fri Dec 30 14:18:46 2022 -0800

    crypto: ccp - Avoid page allocation failure warning for SEV_GET_ID2
    
    [ Upstream commit 91dfd98216d817ec5f1c55890bacb7b4fe9b068a ]
    
    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: d6112ea0cb34 ("crypto: ccp - introduce SEV_GET_ID2 command")
    Reported-by: Andy Nguyen <theflow@xxxxxxxxxx>
    Reported-by: Peter Gonda <pgonda@xxxxxxxxxx>
    Suggested-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
    Acked-by: Tom Lendacky <thomas.lendacky@xxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index 6edd938ce6acc..e70ae98de1189 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -631,7 +631,14 @@ static int sev_ioctl_do_get_id2(struct sev_issue_cmd *argp)
 	input_address = (void __user *)input.address;
 
 	if (input.address && input.length) {
-		id_blob = kzalloc(input.length, GFP_KERNEL);
+		/*
+		 * The length of the ID shouldn't be assumed by software since
+		 * it may change in the future.  The allocation size is limited
+		 * to 1 << (PAGE_SHIFT + MAX_ORDER - 1) by the page allocator.
+		 * If the allocation fails, simply return ENOMEM rather than
+		 * warning in the kernel log.
+		 */
+		id_blob = kzalloc(input.length, GFP_KERNEL | __GFP_NOWARN);
 		if (!id_blob)
 			return -ENOMEM;
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux