android_kernel_xiaomi_sm8450/drivers/usb
Johan Hovold 01dfc61f72 USB: dwc3: qcom: fix NULL-deref on suspend
[ Upstream commit d2d69354226de0b333d4405981f3d9c41ba8430a ]

The Qualcomm dwc3 glue driver is currently accessing the driver data of
the child core device during suspend and on wakeup interrupts. This is
clearly a bad idea as the child may not have probed yet or could have
been unbound from its driver.

The first such layering violation was part of the initial version of the
driver, but this was later made worse when the hack that accesses the
driver data of the grand child xhci device to configure the wakeup
interrupts was added.

Fixing this properly is not that easily done, so add a sanity check to
make sure that the child driver data is non-NULL before dereferencing it
for now.

Note that this relies on subtleties like the fact that driver core is
making sure that the parent is not suspended while the child is probing.

Reported-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/all/20230325165217.31069-4-manivannan.sadhasivam@linaro.org/
Fixes: d9152161b4 ("usb: dwc3: Add Qualcomm DWC3 glue layer driver")
Fixes: 6895ea55c385 ("usb: dwc3: qcom: Configure wakeup interrupts during suspend")
Cc: stable@vger.kernel.org	# 3.18: a872ab303d5d: "usb: dwc3: qcom: fix use-after-free on runtime-PM wakeup"
Cc: Sandeep Maheswaram <quic_c_sanm@quicinc.com>
Cc: Krishna Kurapati <quic_kriskura@quicinc.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Message-ID: <20230607100540.31045-2-johan+linaro@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-08-26 15:26:49 +02:00
..
atm usb: atm: don't use snprintf() for sysfs attrs 2020-08-25 19:11:18 +02:00
c67x00 Linux 5.9-rc3 2020-08-31 07:11:45 +02:00
cdns3 usb: cdns3: fix NCM gadget RX speed 20x slow than expection at iMX8QM 2023-08-26 15:26:48 +02:00
chipidea usb: chipidea: imx: add missing USB PHY DPDM wakeup setting 2023-08-26 15:26:45 +02:00
class USB: usbtmc: Fix direction for 0-length ioctl control messages 2023-05-30 12:57:53 +01:00
common usb: common: usb-conn-gpio: Prevent bailing out if initial role is none 2023-08-16 18:21:00 +02:00
core USB: quirks: add quirk for Focusrite Scarlett 2023-08-11 11:57:41 +02:00
dwc2 usb: dwc2: fix a devres leak in hw_enable upon suspend resume 2023-04-05 11:23:40 +02:00
dwc3 USB: dwc3: qcom: fix NULL-deref on suspend 2023-08-26 15:26:49 +02:00
early Revert "usb: early: convert to readl_poll_timeout_atomic()" 2021-12-22 09:30:56 +01:00
gadget usb: gadget: udc: core: Introduce check_config to verify USB configuration 2023-08-26 15:26:48 +02:00
host Revert "usb: xhci: tegra: Fix error check" 2023-08-11 11:57:41 +02:00
image USB: microtek: use set_host_byte() 2020-09-16 12:42:10 +02:00
isp1760 usb: isp1760-hcd: convert to readl_poll_timeout_atomic() 2020-09-25 16:30:05 +02:00
misc USB: sisusbvga: Add endpoint checks 2023-05-30 12:57:57 +01:00
mon usb: mon: make mmapped memory read only 2022-10-15 07:55:54 +02:00
mtu3 usb: mtu3: fix kernel panic at qmu transfer done irq handler 2023-05-17 11:47:58 +02:00
musb Revert "usb: common: usb-conn-gpio: Set last role to unknown before initial detection" 2023-07-27 08:44:06 +02:00
phy usb: phy: phy-tahvo: fix memory leak in tahvo_usb_probe() 2023-07-27 08:44:04 +02:00
renesas_usbhs usb: renesas: Fix refcount leak bug 2022-08-25 11:38:13 +02:00
roles Revert "usb: common: usb-conn-gpio: Set last role to unknown before initial detection" 2023-07-27 08:44:06 +02:00
serial USB: serial: simple: sort driver entries 2023-08-11 11:57:40 +02:00
storage usb-storage: alauda: Fix uninit-value in alauda_check_media() 2023-08-16 18:21:00 +02:00
typec usb: typec: altmodes/displayport: fix pin_assignment_show 2023-05-30 12:57:54 +01:00
usbip usb: usbip: add missing device lock on tweak configuration cmd 2022-06-14 18:32:31 +02:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile
usb-skeleton.c