linux/drivers
Ricardo Ribalda 00845427c4 media: v4l2-ioctl: Fix check_ext_ctrls
commit 861f92cb91 upstream.

Drivers that do not use the ctrl-framework use this function instead.

Fix the following issues:

- Do not check for multiple classes when getting the DEF_VAL.
- Return -EINVAL for request_api calls
- Default value cannot be changed, return EINVAL as soon as possible.
- Return the right error_idx
[If an error is found when validating the list of controls passed with
VIDIOC_G_EXT_CTRLS, then error_idx shall be set to ctrls->count to
indicate to userspace that no actual hardware was touched.
It would have been much nicer of course if error_idx could point to the
control index that failed the validation, but sadly that's not how the
API was designed.]

Fixes v4l2-compliance:
Control ioctls (Input 0):
        warn: v4l2-test-controls.cpp(834): error_idx should be equal to count
        warn: v4l2-test-controls.cpp(855): error_idx should be equal to count
		fail: v4l2-test-controls.cpp(813): doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls)
	test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
Buffer ioctls (Input 0):
		fail: v4l2-test-buffers.cpp(1994): ret != EINVAL && ret != EBADR && ret != ENOTTY
	test Requests: FAIL

Cc: stable@vger.kernel.org
Fixes: 6fa6f831f0 ("media: v4l2-ctrls: add core request support")
Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2021-11-18 19:15:53 +01:00
..
accessibility speakup: replace sprintf() by scnprintf() 2021-07-21 13:46:03 +02:00
acpi ACPI fixes for 5.15-rc7 2021-10-22 09:08:08 -10:00
amba ARM: 9120/1: Revert "amba: make use of -1 IRQs warn" 2021-11-06 14:13:31 +01:00
android binder: don't detect sender/target during buffer cleanup 2021-11-12 15:05:49 +01:00
ata libata: fix read log timeout value 2021-11-18 19:15:51 +01:00
atm atm: horizon: Fix spelling mistakes in TX comment 2021-08-08 12:58:42 +01:00
auxdisplay auxdisplay: Replace symbolic permissions with octal permissions 2021-07-16 07:42:35 +02:00
base regmap: Fix for v5.15 2021-10-28 10:00:58 -07:00
bcma Driver core update for 5.15-rc1 2021-09-01 08:44:42 -07:00
block block-5.15-2021-10-17 2021-10-17 19:25:20 -10:00
bluetooth Bluetooth: btusb: Remove WAKEUP_DISABLE and add WAKEUP_AUTOSUSPEND for Realtek devices 2021-08-19 17:08:31 +02:00
bus Driver core fixes for 5.15-rc6 2021-10-17 17:17:28 -10:00
cdrom scsi: sr: cdrom: Move cdrom_read_cdda_bpc() into the sr driver 2021-07-30 22:13:09 -04:00
char tpm: Check for integer overflow in tpm2_map_response_body() 2021-11-18 19:15:53 +01:00
clk One fix for the composite clk that broke when we changed this clk type 2021-10-30 09:55:46 -07:00
clocksource - converted Pistachio platform to use MIPS generic kernel 2021-09-03 11:11:54 -07:00
comedi comedi: vmk80xx: fix bulk and interrupt message timeouts 2021-11-12 15:05:51 +01:00
connector net/connector: Add const qualifier to cb_id 2020-12-16 11:06:49 -08:00
counter counter: 104-quad-8: Describe member 'lock' in 'quad8' 2021-08-09 20:24:38 +01:00
cpufreq Power management fixes for 5.15-rc2 2021-09-17 12:05:04 -07:00
cpuidle - Core Frameworks 2021-09-07 12:38:59 -07:00
crypto crypto: s5p-sss - Add error handling in s5p_aes_probe() 2021-11-18 19:15:53 +01:00
cxl cxl for v5.15 2021-09-09 11:48:27 -07:00
dax libnvdimm for v5.15 2021-09-09 11:39:57 -07:00
dca dca: Use PTR_ERR_OR_ZERO() to simplify code 2020-05-15 16:25:20 +02:00
devfreq devfreq: use HZ macros 2021-09-08 11:50:26 -07:00
dio dio: return -ENOMEM when kzalloc() fails 2021-07-21 15:53:24 +02:00
dma dmaengine updates for v5.15-rc1 2021-09-09 11:07:47 -07:00
dma-buf dma-buf: DMABUF_SYSFS_STATS should depend on DMA_SHARED_BUFFER 2021-09-07 12:42:21 +05:30
edac EDAC/armada-xp: Fix output of uncorrectable error counter 2021-10-14 11:46:03 +02:00
eisa EISA: use DEVICE_ATTR_RO() helper macro 2021-06-04 15:28:34 +02:00
extcon Char / Misc driver updates for 5.14-rc1 2021-07-05 13:42:16 -07:00
firewire FireWire (IEEE 1394) subsystem updates: 2021-09-11 09:47:33 -07:00
firmware firmware/psci: fix application of sizeof to pointer 2021-11-18 19:15:53 +01:00
fpga fpga: ice40-spi: Add SPI device ID table 2021-09-27 14:00:41 -07:00
fsi fsi/sbefifo: Fix reset timeout 2021-06-04 16:06:57 +09:30
gnss treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
gpio gpio: mlxbf2.c: Add check for bgpio_init failure 2021-10-25 10:15:05 +02:00
gpu ce/gf100: fix incorrect CE0 address calculation on some GPUs 2021-11-18 19:15:52 +01:00
greybus greybus: es2: fix kernel-doc warnings 2021-04-16 07:26:50 +02:00
hid HID: amd_sfh: Fix potential NULL pointer dereference 2021-09-27 10:00:43 +02:00
hsi HSI: core: fix resource leaks in hsi_add_client_from_dt() 2021-04-16 00:14:49 +02:00
hv hyperv-fixes for 5.15 2021-10-22 10:31:32 -10:00
hwmon hwmon: (w83793) Fix NULL pointer dereference by removing unnecessary structure field 2021-10-02 05:14:11 -07:00
hwspinlock hwspinlock: add sun6i hardware spinlock support 2021-05-27 22:19:42 -05:00
hwtracing coresight: syscfg: Fix compiler warning 2021-09-14 09:03:16 +02:00
i2c i2c: mlxcpld: Modify register setting for 400KHz frequency 2021-10-04 21:56:20 +02:00
i3c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
idle intel_idle: Adjust the SKX C6 parameters if PC6 is disabled 2021-06-09 17:51:07 +02:00
iio Staging/IIO driver fixes for 5.15-rc6 2021-10-17 17:10:00 -10:00
infiniband RDMA/sa_query: Use strscpy_pad instead of memcpy to copy a string 2021-10-25 11:51:51 -03:00
input Input: i8042 - Add quirk for Fujitsu Lifebook T725 2021-11-18 19:15:51 +01:00
interconnect interconnect: qcom: sdm660: Add missing a2noc qos clocks 2021-09-13 15:49:55 +03:00
iommu iommu/arm: fix ARM_SMMU_QCOM compilation 2021-10-13 21:28:44 +02:00
ipack ipack: ipoctal: fix module reference leak 2021-09-27 17:38:49 +02:00
irqchip irqchip/gic: Work around broken Renesas integration 2021-09-22 14:44:25 +01:00
isdn mISDN: Fix return values of the probe function 2021-10-19 13:09:28 +01:00
leds leds: pca955x: Switch to i2c probe_new 2021-08-20 11:00:08 +02:00
macintosh memblock: introduce saner 'memblock_free_ptr()' interface 2021-09-14 13:23:22 -07:00
mailbox mailbox: cmdq: add multi-gce clocks support for mt8195 2021-08-31 22:57:45 -05:00
mcb mcb: fix error handling in mcb_alloc_bus() 2021-09-14 11:22:26 +02:00
md dm: fix mempool NULL pointer race when completing IO 2021-10-12 13:54:10 -04:00
media media: v4l2-ioctl: Fix check_ext_ctrls 2021-11-18 19:15:53 +01:00
memory Merge branch 'for-v5.15/omap-gpmc' into for-next 2021-07-29 09:03:32 +02:00
memstick Driver core update for 5.15-rc1 2021-09-01 08:44:42 -07:00
message scsi: message: mptfc: Switch from pci_ to dma_ API 2021-06-22 23:00:01 -04:00
mfd - Core Frameworks 2021-09-07 12:38:59 -07:00
misc eeprom: 93xx46: fix MODULE_DEVICE_TABLE 2021-10-15 10:54:02 +02:00
mmc mmc: dw_mmc: Dont wait for DRTO on Write RSP error 2021-11-18 19:15:52 +01:00
most MOST: cdev: rename 'mod_init' & 'mod_exit' functions to be module-specific 2021-07-21 15:46:22 +02:00
mtd mtd: rawnand: qcom: Update code word value for raw read 2021-09-14 19:36:00 +02:00
mux mux: gpio: Simplify code by using dev_err_probe() 2021-04-02 16:28:53 +02:00
net rsi: fix control-message timeout 2021-11-12 15:05:52 +01:00
nfc nfc: port100: fix using -ERRNO as command type mask 2021-10-26 13:42:00 +01:00
ntb Bug fixes and clean-ups for Linux v5.15 2021-09-07 13:05:02 -07:00
nubus nubus: Simplify check in remove callback 2021-08-05 14:37:03 +02:00
nvdimm nvdimm/pmem: stop using q_usage_count as external pgmap refcount 2021-10-25 16:12:32 -07:00
nvme nvmet-tcp: fix header digest verification 2021-10-27 09:20:50 +02:00
nvmem nvmem: Fix shift-out-of-bound (UBSAN) with byte size cells 2021-10-13 15:09:58 +02:00
of memblock: exclude MEMBLOCK_NOMAP regions from kmemleak 2021-10-21 18:30:49 -10:00
opp Merge branches 'pm-pci', 'pm-sleep', 'pm-domains' and 'powercap' 2021-08-30 19:25:42 +02:00
parisc parisc: Move pci_dev_is_behind_card_dino to where it is used 2021-09-09 12:44:31 +02:00
parport parisc architecture updates for kernel 5.15: 2021-09-02 13:16:00 -07:00
pci pci-v5.15-fixes-2 2021-10-16 09:00:46 -07:00
pcmcia Merge 5.14-rc5 into driver-core-next 2021-08-09 09:03:47 +02:00
perf KVM: arm64: Fix PMU probe ordering 2021-09-20 12:43:34 +01:00
phy Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
pinctrl pinctrl: amd: disable and mask interrupts on probe 2021-10-16 23:56:59 +02:00
platform platform/x86: int1092: Fix non sequential device mode handling 2021-10-11 16:39:25 +02:00
pnp bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
power power supply and reset changes for the v5.15 series 2021-08-30 11:47:32 -07:00
powercap powercap: Add Power Limit4 support for Alder Lake SoC 2021-08-25 20:12:16 +02:00
pps pps: clients: parport: Switch to use module_parport_driver() 2021-07-29 17:29:14 +02:00
ps3 powerpc/ps3: Warn on PS3 device errors 2021-06-10 21:44:58 +10:00
ptp ptp: free 'vclock_index' in ptp_clock_release() 2021-10-21 12:50:38 +01:00
pwm pwm: mtk-disp: Implement atomic API .get_state() 2021-09-02 22:27:46 +02:00
rapidio bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
ras RAS/CEC: Correct ce_add_elem()'s returned values 2021-04-07 11:52:26 +02:00
regulator regulator: max14577: Revert "regulator: max14577: Add proper module aliases strings" 2021-09-17 13:16:38 +01:00
remoteproc remoteproc: q6v5_pas: Add sdm660 ADSP PIL compatible 2021-08-04 12:37:32 -05:00
reset reset: socfpga: add empty driver allowing consumers to probe 2021-10-05 12:23:16 +02:00
rpmsg bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
rtc rtc: cmos: Disable irq around direct invocation of cmos_interrupt() 2021-09-14 10:20:19 +02:00
s390 s390 updates for 5.15-rc4 2021-10-01 14:45:23 -07:00
sbus module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
scsi scsi: qla2xxx: Fix use after free in eh_abort path 2021-11-18 19:15:52 +01:00
sh sh: superhyway: Simplify check in remove callback 2021-08-05 14:37:03 +02:00
siox bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
slimbus Driver core update for 5.15-rc1 2021-09-01 08:44:42 -07:00
soc Revert "soc: imx: gpcv2: move reset assert after requesting domain power up" 2021-11-06 14:13:30 +01:00
soundwire sound updates for 5.15-rc1 2021-09-01 10:29:29 -07:00
spi spi: Fixes for v5.15 2021-10-28 10:04:39 -07:00
spmi bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
ssb bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
staging media: rkvdec: Support dynamic resolution changes 2021-11-18 19:15:53 +01:00
target scsi: target: Fix spelling mistake "CONFLIFT" -> "CONFLICT" 2021-09-22 00:17:29 -04:00
tc The main MIPS changes for 5.6: 2020-01-31 11:28:31 -08:00
tee tee: optee: Fix missing devices unregister during optee_remove 2021-10-12 13:24:39 +02:00
thermal thermal/drivers/tsens: Fix wrong check for tzd in irq handlers 2021-09-21 15:17:11 +02:00
thunderbolt thunderbolt: build kunit tests without structleak plugin 2021-10-06 17:53:49 -06:00
tty Serial driver fix for 5.15-rc6 2021-10-17 17:06:31 -10:00
uio uio: Remove leading spaces in Kconfig 2021-05-21 14:52:37 +02:00
usb usb: xhci: Enable runtime-pm by default on AMD Yellow Carp platform 2021-11-18 19:15:50 +01:00
vdpa vduse: Fix race condition between resetting and irq injecting 2021-10-22 06:49:14 -04:00
vfio vfio/pci: add missing identifier name in argument of function prototype 2021-09-23 14:12:36 -06:00
vhost virtio,vdpa: fixes 2021-10-17 18:17:19 -10:00
video video: fbdev: gbefb: Only instantiate device when built for IP32 2021-10-06 11:12:28 +02:00
virt virt: acrn: Do hcall_destroy_vm() before resource release 2021-07-27 16:48:45 +02:00
virtio virtio-ring: fix DMA metadata flags 2021-10-27 15:54:34 -04:00
visorbus visorbus: fix error return code in visorchipset_init() 2021-06-04 15:27:26 +02:00
vlynq bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
vme bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
w1 w1: ds2482: fix kernel-doc syntax in file 2021-05-26 09:11:05 +02:00
watchdog watchdog: Fix OMAP watchdog early handling 2021-10-26 20:22:51 +02:00
xen xen: branch for v5.15-rc5 2021-10-08 12:55:23 -07:00
zorro zorro: Drop useless (and hardly used) .driver member in struct zorro_dev 2021-08-05 14:37:04 +02:00
Kconfig firmware: include drivers/firmware/Kconfig unconditionally 2021-10-07 16:51:26 +02:00
Makefile remove the lightnvm subsystem 2021-08-14 15:54:09 -06:00