linux-stable/drivers/xen
Harshit Mogalapalli 0bf874183b xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource()
[ Upstream commit 8b997b2bb2 ]

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: 3ad0876554 ("xen/privcmd: add IOCTL_PRIVCMD_MMAP_RESOURCE")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20221126050745.778967-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-31 13:14:04 +01:00
..
events
xen-pciback xen-pciback: Allow setting PCI_MSIX_FLAGS_MASKALL too 2022-12-02 17:41:10 +01:00
xenbus xen/xenbus: fix return type in xenbus_file_read() 2022-08-25 11:40:14 +02:00
xenfs
acpi.c
arm-device.c
balloon.c
biomerge.c
cpu_hotplug.c
dbgp.c
efi.c
evtchn.c
features.c x86/xen: Remove undefined behavior in setup_features() 2022-06-29 09:03:24 +02:00
gntalloc.c
gntdev-common.h xen/gntdev: Accommodate VMA splitting 2022-10-26 12:34:24 +02:00
gntdev-dmabuf.c
gntdev-dmabuf.h
gntdev.c xen/gntdev: Accommodate VMA splitting 2022-10-26 12:34:24 +02:00
grant-table.c xen/grants: prevent integer overflow in gnttab_dma_alloc_pages() 2022-09-08 12:28:05 +02:00
Kconfig
Makefile
manage.c
mcelog.c
mem-reservation.c
pci.c
pcpu.c xen/pcpu: fix possible memory leak in register_pcpu() 2022-11-26 09:24:40 +01:00
platform-pci.c xen/platform-pci: add missing free_irq() in error path 2022-12-02 17:41:10 +01:00
privcmd-buf.c
privcmd.c xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource() 2022-12-31 13:14:04 +01:00
privcmd.h
pvcalls-back.c
pvcalls-front.c
pvcalls-front.h
swiotlb-xen.c
sys-hypervisor.c
time.c
unpopulated-alloc.c
xen-acpi-pad.c
xen-acpi-processor.c
xen-balloon.c
xen-front-pgdir-shbuf.c
xen-scsiback.c
xlate_mmu.c