Patch "xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource()" 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

    xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource()

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:
     xen-privcmd-fix-a-possible-warning-in-privcmd_ioctl_.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 24ee8ae19b52e8ecd784d11965da8ef3a62d28ea
Author: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
Date:   Fri Nov 25 21:07:45 2022 -0800

    xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource()
    
    [ Upstream commit 8b997b2bb2c53b76a6db6c195930e9ab8e4b0c79 ]
    
    As 'kdata.num' is user-controlled data, if user tries to allocate
    memory larger than(>=) MAX_ORDER, then kcalloc() will fail, it
    creates a stack trace and messes up dmesg with a warning.
    
    Call trace:
    -> privcmd_ioctl
    --> privcmd_ioctl_mmap_resource
    
    Add __GFP_NOWARN in order to avoid too large allocation warning.
    This is detected by static analysis using smatch.
    
    Fixes: 3ad0876554ca ("xen/privcmd: add IOCTL_PRIVCMD_MMAP_RESOURCE")
    Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
    Link: https://lore.kernel.org/r/20221126050745.778967-1-harshit.m.mogalapalli@xxxxxxxxxx
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index cd5f2f09468e..28537a1a0e0b 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -760,7 +760,7 @@ static long privcmd_ioctl_mmap_resource(struct file *file,
 		goto out;
 	}
 
-	pfns = kcalloc(kdata.num, sizeof(*pfns), GFP_KERNEL);
+	pfns = kcalloc(kdata.num, sizeof(*pfns), GFP_KERNEL | __GFP_NOWARN);
 	if (!pfns) {
 		rc = -ENOMEM;
 		goto out;



[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