linux/drivers/dma-buf
T.J. Mercier ea5ff5d351 dma-buf: heaps: Fix off-by-one in CMA heap fault handler
Until VM_DONTEXPAND was added in commit 1c1914d6e8 ("dma-buf: heaps:
Don't track CMA dma-buf pages under RssFile") it was possible to obtain
a mapping larger than the buffer size via mremap and bypass the overflow
check in dma_buf_mmap_internal. When using such a mapping to attempt to
fault past the end of the buffer, the CMA heap fault handler also checks
the fault offset against the buffer size, but gets the boundary wrong by
1. Fix the boundary check so that we don't read off the end of the pages
array and insert an arbitrary page in the mapping.

Reported-by: Xingyu Jin <xingyuj@google.com>
Fixes: a5d2d29e24 ("dma-buf: heaps: Move heap-helper logic into the cma_heap implementation")
Cc: stable@vger.kernel.org # Applicable >= 5.10. Needs adjustments only for 5.10.
Signed-off-by: T.J. Mercier <tjmercier@google.com>
Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240830192627.2546033-1-tjmercier@google.com
2024-09-09 15:37:20 +05:30
..
heaps dma-buf: heaps: Fix off-by-one in CMA heap fault handler 2024-09-09 15:37:20 +05:30
Kconfig udmabuf: add CONFIG_MMU dependency 2024-07-12 15:52:10 -07:00
Makefile
dma-buf-sysfs-stats.c
dma-buf-sysfs-stats.h
dma-buf.c
dma-fence-array.c
dma-fence-chain.c
dma-fence-unwrap.c
dma-fence.c
dma-heap.c dma-buf: align fd_flags and heap_flags with dma_heap_allocation_data 2024-06-05 14:52:15 +05:30
dma-resv.c dma-buf: add a warning when drv try to reserve 0 fence slots 2024-05-31 10:12:52 +02:00
selftest.c
selftest.h
selftests.h
st-dma-fence-chain.c
st-dma-fence-unwrap.c
st-dma-fence.c dma-buf: handle testing kthreads creation failure 2024-05-27 16:09:22 +02:00
st-dma-resv.c
sw_sync.c
sync_debug.c
sync_debug.h
sync_file.c
sync_trace.h
udmabuf.c udmabuf: pin the pages using memfd_pin_folios() API 2024-07-12 15:52:11 -07:00