linux-uconsole/drivers
Rodrigo Siqueira 5d60d39814 drm/drm_vblank: Change EINVAL by the correct errno
[ Upstream commit aed6105b28 ]

For historical reasons, the function drm_wait_vblank_ioctl always return
-EINVAL if something gets wrong. This scenario limits the flexibility
for the userspace to make detailed verification of any problem and take
some action. In particular, the validation of “if (!dev->irq_enabled)”
in the drm_wait_vblank_ioctl is responsible for checking if the driver
support vblank or not. If the driver does not support VBlank, the
function drm_wait_vblank_ioctl returns EINVAL, which does not represent
the real issue; this patch changes this behavior by return EOPNOTSUPP.
Additionally, drm_crtc_get_sequence_ioctl and
drm_crtc_queue_sequence_ioctl, also returns EINVAL if vblank is not
supported; this patch also changes the return value to EOPNOTSUPP in
these functions. Lastly, these functions are invoked by libdrm, which is
used by many compositors; because of this, it is important to check if
this change breaks any compositor. In this sense, the following projects
were examined:

* Drm-hwcomposer
* Kwin
* Sway
* Wlroots
* Wayland
* Weston
* Mutter
* Xorg (67 different drivers)

For each repository the verification happened in three steps:

* Update the main branch
* Look for any occurrence of "drmCrtcQueueSequence",
  "drmCrtcGetSequence", and "drmWaitVBlank" with the command git grep -n
  "STRING".
* Look in the git history of the project with the command
git log -S<STRING>

None of the above projects validate the use of EINVAL when using
drmWaitVBlank(), which make safe, at least for these projects, to change
the return values. On the other hand, mesa and xserver project uses
drmCrtcQueueSequence() and drmCrtcGetSequence(); this change is harmless
for both projects.

Change since V5 (Pekka Paalanen):
 - Check if the change also affects Mutter

Change since V4 (Daniel):
 - Also return EOPNOTSUPP in drm_crtc_[get|queue]_sequence_ioctl

Change since V3:
 - Return EINVAL for _DRM_VBLANK_SIGNAL (Daniel)

Change since V2:
 Daniel Vetter and Chris Wilson
 - Replace ENOTTY by EOPNOTSUPP
 - Return EINVAL if the parameters are wrong

Cc: Keith Packard <keithp@keithp.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191002140516.adeyj3htylimmlmg@smtp.gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:35:01 +01:00
..
accessibility
acpi ACPI: PM: Avoid attaching ACPI PM domain to certain devices 2019-12-17 20:35:06 +01:00
amba
android binder: Handle start==NULL in binder_update_page_range() 2019-12-13 08:52:52 +01:00
ata ata: ahci: mvebu: do Armada 38x configuration only on relevant SoCs 2019-12-05 09:21:06 +01:00
atm atm: zatm: Fix empty body Clang warnings 2019-12-01 09:16:41 +01:00
auxdisplay auxdisplay: panel: need to delete scan_timer when misc_register fails in panel_attach 2019-09-06 10:21:56 +02:00
base drivers/base/platform.c: kmemleak ignore a known leak 2019-12-05 09:21:04 +01:00
bcma
block drbd: Change drbd_request_detach_interruptible's return type to int 2019-12-17 20:35:31 +01:00
bluetooth Bluetooth: hci_bcm: Handle specific unknown packets after firmware loading 2019-12-05 09:20:39 +01:00
bus bus: ti-sysc: Fix getting optional clocks in clock_roles 2019-12-13 08:51:23 +01:00
cdrom cdrom: don't attempt to fiddle with cdo->capability 2019-12-01 09:16:20 +01:00
char hwrng: omap3-rom - Call clk_disable_unprepare() on exit only if not idled 2019-12-31 16:34:55 +01:00
clk clk: renesas: rcar-gen3: Set state when registering SD clocks 2019-12-13 08:52:32 +01:00
clocksource clocksource/drivers/fttmr010: Fix invalid interrupt register access 2019-12-05 09:20:38 +01:00
connector
cpufreq cpufreq: powernv: fix stack bloat and hard limit on number of CPUs 2019-12-17 20:35:03 +01:00
cpuidle cpuidle: Do not unset the driver if it is there already 2019-12-17 20:35:00 +01:00
crypto crypto: ccp - fix uninitialized list head 2019-12-13 08:52:47 +01:00
dax
dca
devfreq PM / devfreq: Lock devfreq in trans_stat_show 2019-12-17 20:35:03 +01:00
dio
dma dmaengine: dw-dmac: implement dma protection control setting 2019-12-13 08:51:43 +01:00
dma-buf dma-buf: Fix memory leak in sync_file_merge() 2019-12-21 10:57:38 +01:00
edac EDAC, thunderx: Fix memory leak in thunderx_l2c_threaded_isr() 2019-12-01 09:16:18 +01:00
eisa
extcon extcon: max8997: Fix lack of path setting in USB device mode 2019-12-13 08:51:15 +01:00
firewire
firmware firmware: arm_scmi: Avoid double free in error flow 2019-12-17 20:35:52 +01:00
fmc
fpga fpga: altera-ps-spi: Fix getting of optional confd gpio 2019-09-21 07:16:53 +02:00
fsi fsi: scom: Don't abort operations for minor errors 2019-09-06 10:22:19 +02:00
gnss
gpio gpiolib: acpi: Add Terra Pad 1061 to the run_edge_events_on_boot_blacklist 2019-12-17 20:35:59 +01:00
gpu drm/drm_vblank: Change EINVAL by the correct errno 2019-12-31 16:35:01 +01:00
hid HID: core: check whether Usage Page item is after Usage ID items 2019-12-05 09:21:34 +01:00
hsi
hv vmbus: keep pointer to ring buffer page 2019-11-20 18:47:31 +01:00
hwmon hwmon: (npcm-750-pwm-fan) Change initial pwm target to 255 2019-11-24 08:21:01 +01:00
hwspinlock
hwtracing intel_th: pci: Add Tiger Lake CPU support 2019-12-17 20:35:02 +01:00
i2c i2c: imx: don't print error message on probe defer 2019-12-13 08:51:57 +01:00
ide
idle
iio iio: light: bh1750: Resolve compiler warning and make code more readable 2019-12-31 16:34:48 +01:00
infiniband IB/iser: bound protection_sg size by data_sg size 2019-12-31 16:34:49 +01:00
input Input: Fix memory leak in psxpad_spi_probe 2019-12-13 08:52:40 +01:00
iommu iommu/amd: Fix line-break in error log reporting 2019-12-13 08:52:00 +01:00
ipack
irqchip irqchip/irq-mvebu-icu: Fix wrong private data retrieval 2019-11-24 08:19:40 +01:00
isdn staging: gigaset: add endpoint-type sanity check 2019-12-17 20:34:33 +01:00
leds leds: trigger: netdev: fix handling on interface rename 2019-12-17 20:35:54 +01:00
lightnvm lightnvm: pblk: consider max hw sectors supported for max_write_pgs 2019-11-24 08:20:52 +01:00
macintosh macintosh/windfarm_smu_sat: Fix debug output 2019-12-01 09:16:37 +01:00
mailbox mailbox: mailbox-test: fix null pointer if no mmio 2019-12-05 09:21:35 +01:00
mcb
md dm btree: increase rebalance threshold in __rebalance2() 2019-12-21 10:57:41 +01:00
media media: flexcop-usb: fix NULL-ptr deref in flexcop_usb_transfer_init() 2019-12-31 16:34:57 +01:00
memory memory: omap-gpmc: Get the header of the enum 2019-12-05 09:20:29 +01:00
memstick memstick: jmb38x_ms: Fix an error handling path in 'jmb38x_ms_probe()' 2019-10-29 09:20:07 +01:00
message
mfd mfd: max8997: Enale irq-wakeup unconditionally 2019-12-01 09:16:57 +01:00
misc altera-stapl: check for a null key before strcasecmp'ing it 2019-12-13 08:51:56 +01:00
mmc mmc: block: Add CMD13 polling for MMC IOCTLS with R1B response 2019-12-21 10:57:21 +01:00
mtd mtd: spear_smi: Fix Write Burst mode 2019-12-17 20:34:42 +01:00
mux
net mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring 2019-12-31 16:35:00 +01:00
nfc NFC: nxp-nci: Fix NULL pointer dereference after I2C communication error 2019-12-13 08:51:03 +01:00
ntb ntb: intel: fix return value for ndev_vec_mask() 2019-12-01 09:17:13 +01:00
nubus
nvdimm libnvdimm/region: Initialize bad block for volatile namespaces 2019-10-11 18:21:20 +02:00
nvme nvme: Free ctrl device name on init failure 2019-12-13 08:51:53 +01:00
nvmem nvmem: core: return error code instead of NULL from nvmem_device_get 2019-11-20 18:46:31 +01:00
of of: unittest: fix memory leak in attach_node_and_children 2019-12-17 20:36:04 +01:00
opp OPP: Return error on error from dev_pm_opp_get_opp_count() 2019-11-24 08:20:06 +01:00
oprofile
parisc parisc: Disable HP HSC-PCI Cards to prevent kernel crash 2019-10-05 13:10:04 +02:00
parport
pci PCI: Apply Cavium ACS quirk to ThunderX2 and ThunderX3 2019-12-21 10:57:24 +01:00
pcmcia
perf drivers/perf: arm_pmu: Fix failure path in PM notifier 2019-08-06 19:06:55 +02:00
phy phy: renesas: rcar-gen3-usb2: Fix sysfs interface of "role" 2019-12-17 20:34:45 +01:00
pinctrl pinctrl: devicetree: Avoid taking direct reference to device name string 2019-12-31 16:34:53 +01:00
platform platform/x86: hp-wmi: Fix ACPI errors caused by passing 0 as input size 2019-12-05 09:21:35 +01:00
pnp
power power: supply: cpcap-battery: Fix signed counter sample register 2019-12-17 20:35:37 +01:00
powercap
pps drivers/pps/pps.c: clear offset flags in PPS_SETPARAMS ioctl 2019-08-04 09:30:56 +02:00
ps3
ptp
pwm pwm: Clear chip_data in pwm_put() 2019-12-05 09:21:29 +01:00
rapidio drivers/rapidio/devices/rio_mport_cdev.c: NUL terminate some strings 2019-08-06 19:06:52 +02:00
ras
regulator regulator: max8907: Fix the usage of uninitialized variable in max8907_regulator_probe() 2019-12-31 16:34:56 +01:00
remoteproc remoteproc: qcom: q6v5: Fix a race condition on fatal crash 2019-11-24 08:20:29 +01:00
reset reset: Fix memory leak in reset_control_array_put() 2019-12-05 09:19:36 +01:00
rpmsg rpmsg: glink: Free pending deferred work on remove 2019-12-21 10:57:30 +01:00
rtc rtc: disable uie before setting time and enable after 2019-12-17 20:35:43 +01:00
s390 scsi: zfcp: trace channel log even for FCP command responses 2019-12-17 20:35:22 +01:00
sbus
scsi scsi: qla2xxx: Change discovery state before PLOGI 2019-12-21 10:57:42 +01:00
sfi
sh
siox
slimbus slimbus: ngd: Fix build error on x86 2019-12-13 08:51:54 +01:00
sn
soc soc: renesas: r8a77990-sysc: Fix initialization order of 3DG-{A,B} 2019-12-13 08:52:29 +01:00
soundwire soundwire: intel: Fix uninitialized adev deref 2019-11-20 18:45:22 +01:00
spi spi: Add call to spi_slave_abort() function when spidev driver is released 2019-12-31 16:34:48 +01:00
spmi
ssb
staging staging: rtl8188eu: fix possible null dereference 2019-12-31 16:34:49 +01:00
target scsi: target/tcmu: Fix queue_cmd_ring() declaration 2019-12-05 09:19:47 +01:00
tc
tee tee: optee: add missing of_node_put after of_device_is_available 2019-11-24 08:19:08 +01:00
thermal thermal: Fix deadlock in thermal thermal_zone_device_check 2019-12-13 08:52:50 +01:00
thunderbolt thunderbolt: Power cycle the router if NVM authentication fails 2019-12-05 09:21:27 +01:00
tty vcs: prevent write access to vcsu devices 2019-12-13 08:52:51 +01:00
uio vmbus: keep pointer to ring buffer page 2019-11-20 18:47:31 +01:00
usb usb: renesas_usbhs: add suspend event support in gadget mode 2019-12-31 16:34:54 +01:00
uwb
vfio vfio/pci: call irq_bypass_unregister_producer() before freeing irq 2019-12-21 10:57:37 +01:00
vhost vhost/vsock: split packets to send using multiple buffers 2019-12-01 09:16:08 +01:00
video video/hdmi: Fix AVI bar unpack 2019-12-17 20:35:17 +01:00
virt virt: vbox: fix memory leak in hgcm_call_preprocess_linaddr 2019-11-06 13:06:04 +01:00
virtio virtio-balloon: fix managed page counts when migrating pages between zones 2019-12-17 20:34:43 +01:00
visorbus
vlynq
vme
w1 w1: IAD Register is yet readable trough iad sys file. Fix snprintf (%u for unsigned, count for max size). 2019-12-01 09:16:22 +01:00
watchdog watchdog: aspeed: Fix clock behaviour for ast2600 2019-12-13 08:52:54 +01:00
xen pvcalls-front: don't return error when the ring is full 2019-12-17 20:35:32 +01:00
zorro
Kconfig
Makefile