linux/drivers/media/rc
Alan Stern 608e58a0f4 media: mceusb: Use new usb_control_msg_*() routines
Automatic kernel fuzzing led to a WARN about invalid pipe direction in
the mceusb driver:

------------[ cut here ]------------
usb 6-1: BOGUS control dir, pipe 80000380 doesn't match bRequestType 40
WARNING: CPU: 0 PID: 2465 at drivers/usb/core/urb.c:410
usb_submit_urb+0x1326/0x1820 drivers/usb/core/urb.c:410
Modules linked in:
CPU: 0 PID: 2465 Comm: kworker/0:2 Not tainted 5.19.0-rc4-00208-g69cb6c6556ad #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
Workqueue: usb_hub_wq hub_event
RIP: 0010:usb_submit_urb+0x1326/0x1820 drivers/usb/core/urb.c:410
Code: 7c 24 40 e8 ac 23 91 fd 48 8b 7c 24 40 e8 b2 70 1b ff 45 89 e8
44 89 f1 4c 89 e2 48 89 c6 48 c7 c7 a0 30 a9 86 e8 48 07 11 02 <0f> 0b
e9 1c f0 ff ff e8 7e 23 91 fd 0f b6 1d 63 22 83 05 31 ff 41
RSP: 0018:ffffc900032becf0 EFLAGS: 00010282
RAX: 0000000000000000 RBX: ffff8881100f3058 RCX: 0000000000000000
RDX: ffffc90004961000 RSI: ffff888114c6d580 RDI: fffff52000657d90
RBP: ffff888105ad90f0 R08: ffffffff812c3638 R09: 0000000000000000
R10: 0000000000000005 R11: ffffed1023504ef1 R12: ffff888105ad9000
R13: 0000000000000040 R14: 0000000080000380 R15: ffff88810ba96500
FS: 0000000000000000(0000) GS:ffff88811a800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffe810bda58 CR3: 000000010b720000 CR4: 0000000000350ef0
Call Trace:
<TASK>
usb_start_wait_urb+0x101/0x4c0 drivers/usb/core/message.c:58
usb_internal_control_msg drivers/usb/core/message.c:102 [inline]
usb_control_msg+0x31c/0x4a0 drivers/usb/core/message.c:153
mceusb_gen1_init drivers/media/rc/mceusb.c:1431 [inline]
mceusb_dev_probe+0x258e/0x33f0 drivers/media/rc/mceusb.c:1807

The reason for the warning is clear enough; the driver sends an
unusual read request on endpoint 0 but does not set the USB_DIR_IN bit
in the bRequestType field.

More importantly, the whole situation can be avoided and the driver
simplified by converting it over to the relatively new
usb_control_msg_recv() and usb_control_msg_send() routines.  That's
what this fix does.

Link: https://lore.kernel.org/all/CAB7eexLLApHJwZfMQ=X-PtRhw0BgO+5KcSMS05FNUYejJXqtSA@mail.gmail.com/
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: stable@vger.kernel.org
Reported-and-tested-by: Rondreis <linhaoguo86@gmail.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/YwkfnBFCSEVC6XZu@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-30 15:32:07 +02:00
..
img-ir media: rc: img-ir: Make use of the helper function devm_platform_ioremap_resource() 2021-09-30 10:07:50 +02:00
keymaps media: Makefiles: sort entries where it fits 2022-03-14 09:42:59 +01:00
ati_remote.c media: ati-remote: remove private err() macro 2022-07-15 14:54:59 +01:00
bpf-lirc.c bpf: Move rcu lock management out of BPF_PROG_RUN routines 2022-04-19 09:45:47 -07:00
ene_ir.c media: rc: rename s_learning_mode() to s_wideband_receiver() 2021-07-22 08:21:53 +02:00
ene_ir.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
fintek-cir.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
fintek-cir.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
gpio-ir-recv.c media: rc: gpio-ir-recv: add QoS support for cpuidle system 2020-09-27 11:27:23 +02:00
gpio-ir-tx.c media: gpio-ir-tx: simplify wait logic 2022-05-08 07:07:16 +02:00
igorplugusb.c media: igorplugusb: use correct size pass to igorplugusb_probe() 2022-07-15 14:52:20 +01:00
iguanair.c media: iguanair: no superfluous usb_unlink_urb() 2022-06-20 10:30:33 +01:00
imon_raw.c media: imon_raw: respect DMA coherency 2022-06-20 10:30:33 +01:00
imon.c media: imon: reorganize serialization 2022-05-13 11:23:38 +02:00
ir_toy.c media: ir_toy: free before error exiting 2022-01-24 01:35:35 +01:00
ir-hix5hd2.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ir-imon-decoder.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ir-jvc-decoder.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ir-mce_kbd-decoder.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ir-nec-decoder.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ir-rc5-decoder.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ir-rc6-decoder.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ir-rcmm-decoder.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ir-rx51.c media: ir-rx51: Switch to atomic PWM API 2021-11-15 08:29:29 +00:00
ir-sanyo-decoder.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ir-sharp-decoder.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ir-sony-decoder.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ir-spi.c media: rc: ir-spi: Drop empty spi_driver remove callback 2021-11-15 08:28:30 +00:00
ir-xmp-decoder.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ite-cir.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ite-cir.h media: rc: ite-cir: replace some an EN DASH 2021-06-04 08:10:42 +02:00
Kconfig media: media/*/Kconfig: sort entries 2022-03-18 05:58:35 +01:00
lirc_dev.c media: rc: Directly use ida_free() 2022-06-20 10:30:33 +01:00
Makefile media: Makefiles: sort entries where it fits 2022-03-14 09:42:59 +01:00
mceusb.c media: mceusb: Use new usb_control_msg_*() routines 2022-08-30 15:32:07 +02:00
meson-ir-tx.c media: meson-ir-tx: remove superfluous dev_err() 2022-04-24 07:30:34 +01:00
meson-ir.c media: rc: meson-ir: Make use of the helper function devm_platform_ioremap_resource() 2021-09-30 10:07:50 +02:00
mtk-cir.c media: mtk-cir: simplify code 2022-01-24 01:38:32 +01:00
nuvoton-cir.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
nuvoton-cir.h media: rc: harmonize infrared durations to microseconds 2020-09-03 16:18:55 +02:00
pwm-ir-tx.c media: rc: pwm-ir-tx: Switch to atomic PWM API 2021-11-15 08:29:05 +00:00
rc-core-priv.h media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
rc-ir-raw.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
rc-loopback.c media: lirc: report ir receiver overflow 2022-01-28 19:32:50 +01:00
rc-main.c media: lirc: ensure lirc device receives repeats 2022-07-15 14:55:23 +01:00
redrat3.c media: redrat3: no unnecessary GFP_ATOMIC 2022-06-20 10:30:33 +01:00
serial_ir.c media: rc: fix timeout handling after switch to microsecond durations 2021-01-11 12:58:44 +01:00
st_rc.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
streamzap.c media: streamzap: avoid unnecessary GFP_ATOMIC 2022-06-20 10:30:33 +01:00
sunxi-cir.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
ttusbir.c media: ttusbir: avoid unnecessary usb_unlink_urb() 2022-06-20 10:30:33 +01:00
winbond-cir.c media: rc-core: rename ir_raw_event_reset to ir_raw_event_overflow 2022-01-28 19:32:50 +01:00
xbox_remote.c media: xbox_remote: xbox_remote_initialize() cannot fail 2022-06-20 10:30:33 +01:00