linux/drivers/gpu/drm
Chris Wilson 83eb64c85b drm: Drop dev->event_lock spinlock around faulting copy_to_user()
In

commit cdd1cf799b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Dec 4 21:03:25 2014 +0000

    drm: Make drm_read() more robust against multithreaded races

I fixed the races by serialising the use of the event by extending the
dev->event_lock. However, as Thomas pointed out, the copy_to_user() may
fault (even the __copy_to_user_inatomic() variant used here) and calling
into the driver backend with the spinlock held is bad news. Therefore we
have to drop the spinlock before the copy, but that exposes us to the
old race whereby a second reader could see an out-of-order event (as the
first reader may claim the first request but fail to copy it back to
userspace and so on returning it to the event list it will be behind the
current event being copied by the second reader).

Reported-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1448462343-2072-1-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-11-26 15:21:06 +01:00
..
amd drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
armada drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
ast drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
atmel-hlcdc drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
bochs drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
bridge drm/panel: Changes for v4.4-rc1 2015-11-05 11:07:13 +10:00
cirrus drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
exynos drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
fsl-dcu drm: Stop using drm_vblank_count() as the hw frame counter 2015-10-07 16:13:52 +02:00
gma500 drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
i2c Merge branch 'drm-tda998x-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into drm-next 2015-10-15 14:17:13 +10:00
i810
i915 drm/i915: fix potential dangling else problems in for_each_ macros 2015-11-25 09:29:32 +01:00
imx drm/imx: Remove local fbdev emulation Kconfig option 2015-11-24 11:41:50 +01:00
mga drm/irq: Use unsigned int pipe in public API 2015-10-06 12:57:47 +02:00
mgag200 drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
msm drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
nouveau drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
omapdrm drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
panel spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
qxl drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
r128 drm/irq: Use unsigned int pipe in public API 2015-10-06 12:57:47 +02:00
radeon drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
rcar-du drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
rockchip drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
savage
shmobile drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
sis include/uapi/drm/sis_drm.h: move sis_file_private to drivers/gpu/drm/sis/sis_drv.h 2015-10-16 11:27:46 +10:00
sti drm/sti: load HQVDP firmware the first time HQVDP's plane is used 2015-11-03 13:04:56 +01:00
tdfx
tegra drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
tilcdc drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
ttm drm/ttm: Fix memory space allocation v2 2015-09-15 00:57:01 -07:00
udl drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
vc4 drm/vc4: Make sure that planes aren't scaled. 2015-11-17 12:27:03 -08:00
vgem drm/vgem: Drop vgem_drm_gem_mmap 2015-10-19 11:00:44 +02:00
via via_drm.h: move struct via_file_private definition to drivers/gpu/drm/via/via_drv.h 2015-10-16 11:27:49 +10:00
virtio drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
vmwgfx drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
ati_pcigart.c
drm_agpsupport.c drm: Remove __OS_HAS_AGP 2015-09-30 10:44:48 +02:00
drm_atomic_helper.c drm: Keep coordinates in the typical x, y, w, h order instead of x, y, h, w 2015-11-24 11:47:46 +01:00
drm_atomic.c drm/atomic: Small documentation fix. 2015-11-24 11:48:36 +01:00
drm_auth.c
drm_bridge.c
drm_bufs.c drm: Remove __OS_HAS_AGP 2015-09-30 10:44:48 +02:00
drm_cache.c
drm_context.c
drm_crtc_helper.c drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
drm_crtc_internal.h
drm_crtc.c drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
drm_debugfs.c
drm_dma.c
drm_dp_helper.c Linux 4.3-rc2 2015-09-24 17:18:41 +02:00
drm_dp_mst_topology.c drm: fix mutex leak in drm_dp_get_mst_branch_device 2015-10-22 08:29:08 +10:00
drm_drv.c drm: misc cleanup 2015-10-16 15:50:57 +02:00
drm_edid_load.c drm: Constify generic_edid_names[] 2015-09-08 13:45:52 +02:00
drm_edid.c drm/edid: Round to closest when computing the CEA/HDMI alternate clock 2015-10-20 12:01:29 +02:00
drm_encoder_slave.c
drm_fb_cma_helper.c drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create() 2015-11-24 11:47:38 +01:00
drm_fb_helper.c drm/core: Fix old_fb handling in pan_display_atomic. 2015-11-17 13:02:14 +02:00
drm_flip_work.c
drm_fops.c drm: Drop dev->event_lock spinlock around faulting copy_to_user() 2015-11-26 15:21:06 +01:00
drm_gem_cma_helper.c Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2015-11-10 09:33:06 -08:00
drm_gem.c drm/gem: Update/Polish docs 2015-11-24 11:41:49 +01:00
drm_global.c
drm_hashtab.c
drm_info.c
drm_internal.h drm: move drm_class into drm_sysfs.c 2015-09-09 15:05:17 +02:00
drm_ioc32.c drm: Remove __OS_HAS_AGP 2015-09-30 10:44:48 +02:00
drm_ioctl.c drm: Enforce unlocked ioctl operation for kms driver ioctls 2015-10-16 15:50:54 +02:00
drm_irq.c drm: Don't oops in drm_calc_timestamping_constants() if drm_vblank_init() wasn't called 2015-11-13 09:55:00 +10:00
drm_legacy.h
drm_lock.c signals: kill block_all_signals() and unblock_all_signals() 2015-11-06 17:50:42 -08:00
drm_memory.c drm: Remove __OS_HAS_AGP 2015-09-30 10:44:48 +02:00
drm_mipi_dsi.c
drm_mm.c drm/mm: Do DRM_MM_CREATE_TOP adj_start calculation after color_adjust 2015-09-08 13:45:47 +02:00
drm_modes.c drm: modes: replace simple_strtoul by kstrtouint 2015-11-24 11:41:53 +01:00
drm_modeset_lock.c drm/atomic: Make sure lock is held in trylock contexts. 2015-09-08 13:45:53 +02:00
drm_of.c drm: Introduce generic probe function for component based masters. 2015-10-20 12:01:29 +02:00
drm_panel.c
drm_pci.c drm/doc: Update docs about device instance setup 2015-09-30 10:06:06 +02:00
drm_plane_helper.c drm: Print the src/dst/clip rectangles in error in drm_plane_helper 2015-11-24 11:47:47 +01:00
drm_platform.c drm/doc: Update docs about device instance setup 2015-09-30 10:06:06 +02:00
drm_prime.c
drm_probe_helper.c drm/sysfs: Send out uevent when connector->force changes 2015-11-24 11:49:34 +01:00
drm_rect.c drm: Add "prefix" parameter to drm_rect_debug_print() 2015-11-24 11:47:46 +01:00
drm_scatter.c
drm_sysfs.c drm/sysfs: Send out uevent when connector->force changes 2015-11-24 11:49:34 +01:00
drm_trace_points.c
drm_trace.h
drm_vm.c drm: Remove __OS_HAS_AGP 2015-09-30 10:44:48 +02:00
drm_vma_manager.c drm/gem: Use kref_get_unless_zero for the weak mmap references 2015-10-19 11:00:44 +02:00
Kconfig drm/vc4: Add KMS support for Raspberry Pi. 2015-10-21 10:33:12 +01:00
Makefile Merge tag 'drm-vc4-next-2015-10-21' of http://github.com/anholt/linux into drm-next 2015-10-22 10:31:17 +10:00