1
0
Fork 0
alistair23-linux/drivers/gpu/drm/vgem
Chris Wilson e42c75ef34 drm/vgem: Replace opencoded version of drm_gem_dumb_map_offset()
[ Upstream commit 119c53d2d4 ]

drm_gem_dumb_map_offset() now exists and does everything
vgem_gem_dump_map does and *ought* to do.

In particular, vgem_gem_dumb_map() was trying to reject mmapping an
imported dmabuf by checking the existence of obj->filp. Unfortunately,
we always allocated an obj->filp, even if unused for an imported dmabuf.
Instead, the drm_gem_dumb_map_offset(), since commit 90378e5891
("drm/gem: drm_gem_dumb_map_offset(): reject dma-buf"), uses the
obj->import_attach to reject such invalid mmaps.

This prevents vgem from allowing userspace mmapping the dumb handle and
attempting to incorrectly fault in remote pages belonging to another
device, where there may not even be a struct page.

v2: Use the default drm_gem_dumb_map_offset() callback

Fixes: af33a9190d ("drm/vgem: Enable dmabuf import interfaces")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: <stable@vger.kernel.org> # v4.13+
Link: https://patchwork.freedesktop.org/patch/msgid/20200708154911.21236-1-chris@chris-wilson.co.uk
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-08-26 10:40:47 +02:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
vgem_drv.c drm/vgem: Replace opencoded version of drm_gem_dumb_map_offset() 2020-08-26 10:40:47 +02:00
vgem_drv.h drm/vgem: drop use of drmP.h 2019-07-17 12:52:55 +02:00
vgem_fence.c dma-buf: rename reservation_object to dma_resv 2019-08-13 09:09:30 +02:00