linux/drivers/usb/gadget/legacy
Lovekesh Solanki dd0eed9e16 USB: gadget: fix NULL pointer dereference in gadget_dev_ioctl()
gadget_dev_ioctl() reads dev->gadget before acquiring dev->lock, but
dev->state is checked after acquiring the lock. Therefore a concurrent
bind can change the device state between these operations, which can
leave ioctl with a stale NULL gadget pointer and causing a NULL pointer
dereference at gadget->ops->ioctl.

Read dev->gadget while holding dev->lock so that the gadget pointer
and device state are sampled consistently.

Cc: stable <stable@kernel.org>
Reported-by: Eulgyu Kim <eulgyukim@snu.ac.kr>
Link: https://lore.kernel.org/all/20260824113510.1141236-1-jjy600901@snu.ac.kr/
Reported-by: Jaeyoung Chung <jjy600901@snu.ac.kr>
Link: https://lore.kernel.org/all/20260824113510.1141236-1-jjy600901@snu.ac.kr/
Signed-off-by: Lovekesh Solanki <lovekeshsolanki00@gmail.com>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://patch.msgid.link/20260825171343.459630-1-lovekeshsolanki00@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-09-01 16:41:43 +02:00
..
acm_ms.c
audio.c usb: gadget: audio: Add HS/SS bInterval params for UAC2 2022-01-31 14:26:18 +01:00
cdc2.c
dbgp.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ether.c
g_ffs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
gmidi.c usb: gadget: add missing MODULE_DESCRIPTION() macros 2024-06-20 19:18:19 +02:00
hid.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
inode.c USB: gadget: fix NULL pointer dereference in gadget_dev_ioctl() 2026-09-01 16:41:43 +02:00
Kconfig media: Kconfig: cleanup VIDEO_DEV dependencies 2022-03-18 05:58:35 +01:00
Makefile
mass_storage.c
multi.c
ncm.c
nokia.c usb: gadget: nokia: correct CONFIG_USB_GADGET_DEBUG_FILES macro name in comment 2026-07-10 15:13:57 +02:00
printer.c
raw_gadget.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
serial.c usb: gadget: Use kstrtobool() instead of strtobool() 2022-11-03 23:46:01 +09:00
tcm_usb_gadget.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
webcam.c usb: gadget: webcam: Make g_webcam loadable again 2023-12-15 18:27:38 +01:00
zero.c usb: gadget: zero: add function wakeup support 2025-10-13 09:11:50 +02:00