linux/drivers/usb
Owen Gu 9ec40fba73 usb: gadget: f_fs: Fix epfile null pointer access after ep enable.
commit cfd6f1a7b4 upstream.

A race condition occurs when ffs_func_eps_enable() runs concurrently
with ffs_data_reset(). The ffs_data_clear() called in ffs_data_reset()
sets ffs->epfiles to NULL before resetting ffs->eps_count to 0, leading
to a NULL pointer dereference when accessing epfile->ep in
ffs_func_eps_enable() after successful usb_ep_enable().

The ffs->epfiles pointer is set to NULL in both ffs_data_clear() and
ffs_data_close() functions, and its modification is protected by the
spinlock ffs->eps_lock. And the whole ffs_func_eps_enable() function
is also protected by ffs->eps_lock.

Thus, add NULL pointer handling for ffs->epfiles in the
ffs_func_eps_enable() function to fix issues

Signed-off-by: Owen Gu <guhuinan@xiaomi.com>
Link: https://lore.kernel.org/r/20250915092907.17802-1-guhuinan@xiaomi.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-12-07 06:09:15 +09:00
..
atm usb: atm: cxacru: Merge cxacru_upload_firmware() into cxacru_heavy_init() 2025-08-28 16:24:27 +02:00
c67x00 usb/c67x00: Replace tasklet with work 2021-01-26 18:36:37 +01:00
cdns3 usb: cdns3: cdnsp-pci: remove redundant pci_disable_device() call 2025-10-19 16:21:39 +02:00
chipidea usb: chipidea: add USB PHY event 2025-08-28 16:24:05 +02:00
class cdc-acm: fix race between initial clearing halt and open 2025-08-28 16:24:26 +02:00
common usb: common: usb-conn-gpio: use a unique name for usb connector device 2025-07-10 15:57:33 +02:00
core usb/core/quirks: Add Huawei ME906S to wakeup quirk 2025-10-29 14:03:12 +01:00
dwc2 usb: dwc2: also exit clock_gating when stopping udc while suspended 2025-07-10 15:57:33 +02:00
dwc3 usb: dwc3: Remove WARN_ON for device endpoint command timeouts 2025-08-28 16:24:35 +02:00
early usb: early: xhci-dbc: Fix early_ioremap leak 2025-08-28 16:24:06 +02:00
gadget usb: gadget: f_fs: Fix epfile null pointer access after ep enable. 2025-12-07 06:09:15 +09:00
host xhci: dbc: fix bogus 1024 byte prefix if ttyDBC read races with stall event 2025-12-07 06:09:15 +09:00
image USB: microtek: use set_host_byte() 2020-09-16 12:42:10 +02:00
isp1760 usb: isp1760: Fix out-of-bounds array access 2022-06-09 10:22:27 +02:00
misc usb: misc: apple-mfi-fastcharge: Make power supply names unique 2025-08-28 16:24:06 +02:00
mon usb: mon: Fix atomicity violation in mon_bin_vma_fault 2024-01-25 14:52:47 -08:00
mtu3 usb: mtu3: fix kernel panic at qmu transfer done irq handler 2023-05-11 23:00:33 +09:00
musb usb: musb: omap2430: fix device leak at unbind 2025-08-28 16:24:32 +02:00
phy usb: phy: twl6030: Fix incorrect type for ret 2025-10-19 16:21:33 +02:00
renesas_usbhs usb: renesas_usbhs: Reorder clock handling and power management in probe 2025-06-27 11:05:16 +01:00
roles usb: roles: set switch registered flag early on 2025-03-13 12:50:37 +01:00
serial USB: serial: option: add Telit FN920C04 ECM compositions 2025-10-29 14:03:12 +01:00
storage USB: storage: Ignore driver CD mode for Realtek multi-mode Wi-Fi dongles 2025-08-28 16:24:35 +02:00
typec usb: typec: fusb302: cache PD RX state 2025-08-28 16:24:31 +02:00
usbip usb: vhci-hcd: Prevent suspending virtually attached devices 2025-10-19 16:21:36 +02:00
Kconfig usb: remove reference to deleted config STB03xxx 2021-08-18 15:32:19 +02:00
Makefile usb: host: remove line for obsolete config USB_HWA_HCD 2021-08-18 15:32:19 +02:00
usb-skeleton.c USB: usb-skeleton: drop redundant in-urb check 2019-10-10 12:41:19 +02:00