linux/drivers/usb
Diego Fernando Mancera Gomez 9dfd800b37 usb: atm: ueagle-atm: reject descriptors that confuse probe and disconnect
uea_probe() distinguishes a pre-firmware device from a post-firmware one
using the USB id (UEA_IS_PREFIRM()), and stores a different object as the
interface data in each case: a 'struct completion' for a pre-firmware
device (to be waited on in .disconnect()), or a 'struct usbatm_data' for a
post-firmware one.

uea_disconnect() instead tells the two apart by the number of interfaces
of the active configuration (a pre-firmware device exposes a single
interface, ADI930 has 2 and eagle has 3), and casts the interface data
accordingly.

Because the two handlers use different criteria, a crafted device that
advertises a pre-firmware id together with a multi-interface descriptor
(or a post-firmware id with a single interface) makes them disagree: the
small 'struct completion' stored by uea_probe() is then passed to
usbatm_usb_disconnect(), which casts it to 'struct usbatm_data' and takes
instance->serialize, reading past the end of the allocation:

  BUG: KASAN: slab-out-of-bounds in __mutex_lock+0x152a/0x1b80
  Read of size 8 at addr ffff8880470e2c60 by task kworker/1:2/982
  ...
   __mutex_lock+0x152a/0x1b80
   usbatm_usb_disconnect+0x70/0x820
   uea_disconnect+0x133/0x2c0
   usb_unbind_interface+0x1dd/0x9e0
  ...
  which belongs to the cache kmalloc-96 of size 96
  The buggy address is located 0 bytes to the right of
   allocated 96-byte region [ffff8880470e2c00, ffff8880470e2c60)

Reject such inconsistent descriptors in uea_probe() so that both handlers
always make the same pre/post-firmware decision.

Reported-by: syzbot+e62a973f8322b3bbe3ac@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e62a973f8322b3bbe3ac
Fixes: e2674dfbed ("usb: atm: ueagle-atm: wait for pre-firmware load in .disconnect()")
Signed-off-by: Diego Fernando Mancera Gomez <diegomancera.dev@gmail.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Link: https://patch.msgid.link/20260717080704.1264-1-diegomancera.dev@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-07-23 08:26:15 -07:00
..
atm usb: atm: ueagle-atm: reject descriptors that confuse probe and disconnect 2026-07-23 08:26:15 -07:00
c67x00
cdns3 usb: cdnsp: fix stream context array leak in cdnsp_alloc_stream_info() 2026-06-25 15:12:15 +01:00
chipidea Linux 7.1-rc6 2026-06-01 17:39:51 +02:00
class usb: cdc_acm: Add quirk for Uniden BC125AT scanner 2026-06-25 15:10:09 +01:00
common USB: ulpi: fix memory leak on registration failure 2026-06-25 15:11:27 +01:00
core USB: core: ratelimit cabling message 2026-07-08 17:19:17 +02:00
dwc2 usb: dwc2: Add include defining struct pci_device_id 2026-07-03 07:38:15 +02:00
dwc3 usb: dwc3: run gadget disconnect from sleepable suspend context 2026-07-08 13:35:22 +02:00
early
fotg210 usb: free iso schedules on failed submit 2026-07-08 13:30:38 +02:00
gadget USB fixes for 7.2-rc3 2026-07-12 12:12:41 -07:00
host usb: xhci: Fix sleep in atomic context in xhci_free_streams() 2026-07-08 13:38:28 +02:00
image Merge 7.0-rc4 into usb-next 2026-03-16 11:50:48 +01:00
isp1760
misc USB fixes for 7.2-rc3 2026-07-12 12:12:41 -07:00
mon
mtu3 usb: mtu3: unmap request DMA on queue failure 2026-06-25 16:04:26 +01:00
musb usb: musb: omap2430: Fix use-after-free in omap2430_probe() 2026-05-22 10:33:43 +02:00
phy usb: phy: isp1301: Use named initializers for struct i2c_device_id 2026-05-21 16:52:36 +02:00
renesas_usbhs usb: renesas_usbhs: use kzalloc_flex 2026-03-18 15:51:48 +01:00
roles usb: roles: get usb role switch from parent only for usb-b-connector 2026-03-11 16:22:22 +01:00
serial USB: serial: keyspan_pda: fix information leak 2026-06-30 10:36:06 +02:00
storage USB: usb-storage: ene_ub6250: restore media-ready check 2026-07-08 13:30:11 +02:00
typec USB fixes for 7.2-rc3 2026-07-12 12:12:41 -07:00
usbip usbip: vudc: fix NULL deref in vep_dequeue() 2026-07-08 13:29:31 +02:00
Kconfig
Makefile usb: cdns3: Add USBSSP platform driver support 2026-04-27 05:14:18 -06:00
usb-skeleton.c