WSL2-Linux-Kernel/drivers/dma-buf
Pavel Skripkin 811b667cef udmabuf: validate ubuf->pagecount
[ Upstream commit 2b6dd600dd ]

Syzbot has reported GPF in sg_alloc_append_table_from_pages(). The
problem was in ubuf->pages == ZERO_PTR.

ubuf->pagecount is calculated from arguments passed from user-space. If
user creates udmabuf with list.size == 0 then ubuf->pagecount will be
also equal to zero; it causes kmalloc_array() to return ZERO_PTR.

Fix it by validating ubuf->pagecount before passing it to
kmalloc_array().

Fixes: fbb0de7950 ("Add udmabuf misc device")
Reported-and-tested-by: syzbot+2c56b725ec547fa9cb29@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20211230142649.23022-1-paskripkin@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:23:24 +02:00
..
heaps dma-buf: cma_heap: Fix mutex locking section 2022-03-08 19:12:37 +01:00
Kconfig dma-buf: DMABUF_SYSFS_STATS should depend on DMA_SHARED_BUFFER 2021-09-07 12:42:21 +05:30
Makefile
dma-buf-sysfs-stats.c
dma-buf-sysfs-stats.h
dma-buf.c dma-buf: WARN on dmabuf release with pending attachments 2021-11-18 19:16:08 +01:00
dma-fence-array.c dma_fence_array: Fix PENDING_ERROR leak in dma_fence_array_signaled() 2022-01-27 11:02:59 +01:00
dma-fence-chain.c
dma-fence.c
dma-heap.c dma-buf: heaps: Fix potential spectre v1 gadget 2022-02-08 18:34:06 +01:00
dma-resv.c
selftest.c
selftest.h
selftests.h
seqno-fence.c
st-dma-fence-chain.c
st-dma-fence.c
sw_sync.c
sync_debug.c
sync_debug.h
sync_file.c
sync_trace.h
udmabuf.c udmabuf: validate ubuf->pagecount 2022-04-08 14:23:24 +02:00