kernel_samsung_a53x/drivers/hid
Charles Yi c8d1e8655c HID: fix HID device resource race between HID core and debugging support
[ Upstream commit fc43e9c857b7aa55efba9398419b14d9e35dcc7d ]

hid_debug_events_release releases resources bound to the HID device instance.
hid_device_release releases the underlying HID device instance potentially
before hid_debug_events_release has completed releasing debug resources bound
to the same HID device instance.

Reference count to prevent the HID device instance from being torn down
preemptively when HID debugging support is used. When count reaches zero,
release core resources of HID device instance using hiddev_free.

The crash:

[  120.728477][ T4396] kernel BUG at lib/list_debug.c:53!
[  120.728505][ T4396] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[  120.739806][ T4396] Modules linked in: bcmdhd dhd_static_buf 8822cu pcie_mhi r8168
[  120.747386][ T4396] CPU: 1 PID: 4396 Comm: hidt_bridge Not tainted 5.10.110 #257
[  120.754771][ T4396] Hardware name: Rockchip RK3588 EVB4 LP4 V10 Board (DT)
[  120.761643][ T4396] pstate: 60400089 (nZCv daIf +PAN -UAO -TCO BTYPE=--)
[  120.768338][ T4396] pc : __list_del_entry_valid+0x98/0xac
[  120.773730][ T4396] lr : __list_del_entry_valid+0x98/0xac
[  120.779120][ T4396] sp : ffffffc01e62bb60
[  120.783126][ T4396] x29: ffffffc01e62bb60 x28: ffffff818ce3a200
[  120.789126][ T4396] x27: 0000000000000009 x26: 0000000000980000
[  120.795126][ T4396] x25: ffffffc012431000 x24: ffffff802c6d4e00
[  120.801125][ T4396] x23: ffffff8005c66f00 x22: ffffffc01183b5b8
[  120.807125][ T4396] x21: ffffff819df2f100 x20: 0000000000000000
[  120.813124][ T4396] x19: ffffff802c3f0700 x18: ffffffc01d2cd058
[  120.819124][ T4396] x17: 0000000000000000 x16: 0000000000000000
[  120.825124][ T4396] x15: 0000000000000004 x14: 0000000000003fff
[  120.831123][ T4396] x13: ffffffc012085588 x12: 0000000000000003
[  120.837123][ T4396] x11: 00000000ffffbfff x10: 0000000000000003
[  120.843123][ T4396] x9 : 455103d46b329300 x8 : 455103d46b329300
[  120.849124][ T4396] x7 : 74707572726f6320 x6 : ffffffc0124b8cb5
[  120.855124][ T4396] x5 : ffffffffffffffff x4 : 0000000000000000
[  120.861123][ T4396] x3 : ffffffc011cf4f90 x2 : ffffff81fee7b948
[  120.867122][ T4396] x1 : ffffffc011cf4f90 x0 : 0000000000000054
[  120.873122][ T4396] Call trace:
[  120.876259][ T4396]  __list_del_entry_valid+0x98/0xac
[  120.881304][ T4396]  hid_debug_events_release+0x48/0x12c
[  120.886617][ T4396]  full_proxy_release+0x50/0xbc
[  120.891323][ T4396]  __fput+0xdc/0x238
[  120.895075][ T4396]  ____fput+0x14/0x24
[  120.898911][ T4396]  task_work_run+0x90/0x148
[  120.903268][ T4396]  do_exit+0x1bc/0x8a4
[  120.907193][ T4396]  do_group_exit+0x8c/0xa4
[  120.911458][ T4396]  get_signal+0x468/0x744
[  120.915643][ T4396]  do_signal+0x84/0x280
[  120.919650][ T4396]  do_notify_resume+0xd0/0x218
[  120.924262][ T4396]  work_pending+0xc/0x3f0

[ Rahul Rameshbabu <sergeantsagara@protonmail.com>: rework changelog ]
Fixes: cd667ce24796 ("HID: use debugfs for events/reports dumping")
Signed-off-by: Charles Yi <be286@163.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-18 12:10:54 +01:00
..
i2c-hid Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
intel-ish-hid Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
usbhid Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-a4tech.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-accutouch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-alps.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-apple.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-appleir.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-asus.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-aureal.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-axff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-belkin.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-betopff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-bigbenff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-cherry.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-chicony.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-cmedia.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-core.c HID: fix HID device resource race between HID core and debugging support 2024-11-18 12:10:54 +01:00
hid-corsair.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-cougar.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-cp2112.c hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip 2024-11-18 11:43:04 +01:00
hid-creative-sb0540.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-cypress.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-debug.c HID: fix HID device resource race between HID core and debugging support 2024-11-18 12:10:54 +01:00
hid-dr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-elan.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-elecom.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-elo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-emsff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-ezkey.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-gaff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-gembird.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-generic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-gfrm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-glorious.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-google-hammer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-gt683r.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-gyration.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-holtek-kbd.c HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event 2024-11-08 11:26:16 +01:00
hid-holtek-mouse.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-holtekff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-hyperv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-icade.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-ids.h HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W 2024-11-18 11:43:14 +01:00
hid-input.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-ite.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-jabra.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-kensington.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-keytouch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-kye.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-lcpower.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-led.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-lenovo.c HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround 2024-11-18 11:43:14 +01:00
hid-lg-g15.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-lg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-lg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-lg2ff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-lg3ff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-lg4ff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-lg4ff.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-lgff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-logitech-dj.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-logitech-hidpp.c HID: logitech-hidpp: Move get_wireless_feature_index() check to hidpp_connect_event() 2024-11-18 11:43:04 +01:00
hid-macally.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-magicmouse.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-maltron.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-mcp2221.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-mf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-microsoft.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-monterey.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-multitouch.c HID: multitouch: Add required quirk for Synaptics 0xcd7e device 2024-11-08 11:26:17 +01:00
hid-nintendo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-nti.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-ntrig.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-ortek.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-penmount.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-petalynx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-picolcd.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-picolcd_backlight.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-picolcd_cir.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-picolcd_core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-picolcd_debugfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-picolcd_fb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-picolcd_lcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-picolcd_leds.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-pl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-plantronics.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-playstation.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-primax.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-prodikeys.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-quirks.c HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W 2024-11-18 11:43:14 +01:00
hid-redragon.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-retrode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-rmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-arvo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-arvo.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-common.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-isku.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-isku.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-kone.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-kone.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-koneplus.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-koneplus.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-konepure.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-kovaplus.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-kovaplus.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-lua.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-lua.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-pyra.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-pyra.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-ryos.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-savu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat-savu.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-roccat.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-saitek.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-samsung.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-sensor-custom.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-sensor-hub.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-sjoy.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-sony.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-speedlink.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-steam.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-steelseries.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-sunplus.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-tivo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-tmff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-topseed.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-twinhan.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-u2fzero.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-uclogic-core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-uclogic-params.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-uclogic-params.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-uclogic-rdesc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-uclogic-rdesc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-udraw-ps3.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-viewsonic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-vivaldi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-waltop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-wiimote-core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-wiimote-debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-wiimote-modules.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-wiimote.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-xinmo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-zpff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hid-zydacron.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hidraw.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uhid.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
wacom.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
wacom_sys.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
wacom_wac.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
wacom_wac.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00