linux-stable/drivers/usb
Hans de Goede 468bb26aca usb: ucsi: Fix ucsi->connector race
commit 0482c34ec6 upstream.

ucsi_init() which runs from a workqueue sets ucsi->connector and
on an error will clear it again.

ucsi->connector gets dereferenced by ucsi_resume(), this checks for
ucsi->connector being NULL in case ucsi_init() has not finished yet;
or in case ucsi_init() has failed.

ucsi_init() setting ucsi->connector and then clearing it again on
an error creates a race where the check in ucsi_resume() may pass,
only to have ucsi->connector free-ed underneath it when ucsi_init()
hits an error.

Fix this race by making ucsi_init() store the connector array in
a local variable and only assign it to ucsi->connector on success.

Fixes: bdc62f2bae ("usb: typec: ucsi: Simplified registration and I/O API")
Cc: stable@vger.kernel.org
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230308154244.722337-3-hdegoede@redhat.com
Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-06 12:12:47 +02:00
..
atm usb: move from strlcpy with unused retval to strscpy 2022-08-19 11:08:54 +02:00
c67x00
cdns3 usb: cdnsp: changes PCI Device ID to fix conflict with CNDS3 driver 2023-03-30 12:51:36 +02:00
chipidea usb: chipidea: core: fix possible concurrent when switch role 2023-03-30 12:51:36 +02:00
class USB: make devnode() callback in usb_class_driver take a const * 2022-10-20 12:11:56 +02:00
common USB: ULPI: fix memory leak with using debugfs_lookup() 2023-03-11 13:50:42 +01:00
core USB: fix memory leak with using debugfs_lookup() 2023-03-11 13:50:39 +01:00
dwc2 usb: dwc2: fix a devres leak in hw_enable upon suspend resume 2023-03-30 12:51:33 +02:00
dwc3 usb: dwc3: gadget: Add 1ms delay after end transfer command without IOC 2023-03-30 12:51:36 +02:00
early usb: early: xhci-dbc: Fix a potential out-of-bound memory access 2023-03-10 09:28:53 +01:00
fotg210 USB: fotg210: fix memory leak with using debugfs_lookup() 2023-03-11 13:50:42 +01:00
gadget usb: gadget: u_audio: don't let userspace block driver unbind 2023-03-30 12:51:34 +02:00
host usb: host: xhci: mvebu: Iterate over array indexes instead of using pointer math 2023-03-11 13:50:44 +01:00
image usb/image: fix repeated words in comments 2022-07-27 14:33:53 +02:00
isp1760
misc usb: misc: onboard-hub: add support for Microchip USB2517 USB 2.0 hub 2023-03-30 12:51:33 +02:00
mon usb: mon: make mmapped memory read only 2022-09-22 15:52:29 +02:00
mtu3 usb: mtu3: fix failed runtime suspend in host only mode 2022-09-30 13:55:48 +02:00
musb usb: musb: mediatek: don't unregister something that wasn't registered 2023-03-10 09:28:53 +01:00
phy usb: isp1301-omap: Convert to i2c's .probe_new() 2022-11-22 17:33:27 +01:00
renesas_usbhs
roles Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
serial USB: serial: option: add support for VW/Skoda "Carstick LTE" 2023-03-03 11:56:17 +01:00
storage uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS583Gen 2 2023-03-30 12:51:25 +02:00
typec usb: ucsi: Fix ucsi->connector race 2023-04-06 12:12:47 +02:00
usbip Including fixes from bpf, netfilter and can. 2022-12-21 08:41:32 -08:00
Kconfig usb: fotg210: Collect pieces of dual mode controller 2022-11-09 12:38:09 +01:00
Makefile usb: fotg210: Collect pieces of dual mode controller 2022-11-09 12:38:09 +01:00
usb-skeleton.c usb: add usb_set_intfdata() documentation 2022-11-29 08:56:09 +01:00