summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nvkm
diff options
context:
space:
mode:
authorT.J. Mercier <tjmercier@google.com>2024-08-30 19:26:26 +0000
committerSumit Semwal <sumit.semwal@linaro.org>2024-09-09 15:37:20 +0530
commitea5ff5d351b520524019f7ff7f9ce418de2dad87 (patch)
tree3af6269f1a4623669dd50b1179821f5486f6b0b9 /drivers/gpu/drm/nouveau/nvkm
parent5a498d4d06d6d9bad76d8a50a7f8fe01670ad46f (diff)
downloadlwn-ea5ff5d351b520524019f7ff7f9ce418de2dad87.tar.gz
lwn-ea5ff5d351b520524019f7ff7f9ce418de2dad87.zip
dma-buf: heaps: Fix off-by-one in CMA heap fault handler
Until VM_DONTEXPAND was added in commit 1c1914d6e8c6 ("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: a5d2d29e24be ("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
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm')
0 files changed, 0 insertions, 0 deletions