acrn-kernel/drivers/phy
Tony Lindgren 0430bfcd46 phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP
[ Upstream commit 7104ba0f1958adb250319e68a15eff89ec4fd36d ]

If the external phy working together with phy-omap-usb2 does not implement
send_srp(), we may still attempt to call it. This can happen on an idle
Ethernet gadget triggering a wakeup for example:

configfs-gadget.g1 gadget.0: ECM Suspend
configfs-gadget.g1 gadget.0: Port suspended. Triggering wakeup
...
Unable to handle kernel NULL pointer dereference at virtual address
00000000 when execute
...
PC is at 0x0
LR is at musb_gadget_wakeup+0x1d4/0x254 [musb_hdrc]
...
musb_gadget_wakeup [musb_hdrc] from usb_gadget_wakeup+0x1c/0x3c [udc_core]
usb_gadget_wakeup [udc_core] from eth_start_xmit+0x3b0/0x3d4 [u_ether]
eth_start_xmit [u_ether] from dev_hard_start_xmit+0x94/0x24c
dev_hard_start_xmit from sch_direct_xmit+0x104/0x2e4
sch_direct_xmit from __dev_queue_xmit+0x334/0xd88
__dev_queue_xmit from arp_solicit+0xf0/0x268
arp_solicit from neigh_probe+0x54/0x7c
neigh_probe from __neigh_event_send+0x22c/0x47c
__neigh_event_send from neigh_resolve_output+0x14c/0x1c0
neigh_resolve_output from ip_finish_output2+0x1c8/0x628
ip_finish_output2 from ip_send_skb+0x40/0xd8
ip_send_skb from udp_send_skb+0x124/0x340
udp_send_skb from udp_sendmsg+0x780/0x984
udp_sendmsg from __sys_sendto+0xd8/0x158
__sys_sendto from ret_fast_syscall+0x0/0x58

Let's fix the issue by checking for send_srp() and set_vbus() before
calling them. For USB peripheral only cases these both could be NULL.

Fixes: 657b306a7b ("usb: phy: add a new driver for omap usb2 phy")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20240128120556.8848-1-tony@atomide.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-02-16 19:06:25 +01:00
..
allwinner phy: sun4i-usb: Add support for the H616 USB PHY 2023-01-04 11:28:56 +01:00
amlogic phy: amlogic: phy-meson-g12a-mipi-dphy-analog: fix CNTL2_DIF_TX_CTL0 value 2023-06-09 10:33:58 +02:00
broadcom phy: phy-brcm-usb: Utilize platform_get_irq_byname_optional() 2023-05-01 08:26:27 +09:00
cadence phy: cadence-torrent: Remove unused `regmap` field from state struct 2022-07-08 10:40:43 +05:30
freescale phy: lynx-28g: serialize concurrent phy_set_mode_ext() calls to shared registers 2023-10-19 23:08:52 +02:00
hisilicon phy: hisilicon: Fix an out of bounds check in hisi_inno_phy_probe() 2023-08-03 10:23:59 +02:00
ingenic phy: ingenic: Fix a typo in ingenic_usb_phy_probe() 2021-03-30 23:35:17 +05:30
intel phy: intel: Use dev_err_probe() to simplify code 2022-09-24 12:34:56 +05:30
lantiq
marvell phy: marvell: phy-mvebu-a3700-comphy: Reset COMPHY registers before USB 3.0 power on 2022-12-31 13:32:46 +01:00
mediatek phy: phy-mtk-dp: Fix an error code in probe() 2023-08-03 10:23:56 +02:00
microchip phy-for-6.1 2022-10-07 16:03:01 -07:00
motorola phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins 2023-10-25 12:03:16 +02:00
mscc
qualcomm phy: qcom-snps-femto-v2: use qcom_snps_hsphy_suspend/resume error code 2023-09-13 09:42:20 +02:00
ralink phy: ralink: mt7621-pci: add sentinel to quirks table 2022-11-05 13:01:25 +05:30
renesas phy: renesas: rcar-gen3-usb2: Fix returning wrong error code 2024-02-16 19:06:24 +01:00
rockchip phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write 2023-09-13 09:42:58 +02:00
samsung pci-v5.20-changes 2022-08-04 19:30:35 -07:00
socionext phy: uniphier-usb3ss: fix unintended writing zeros to PHY register 2021-12-24 10:06:38 +05:30
st phy: st: miphy28lp: use _poll_timeout functions for waits 2023-05-24 17:32:41 +01:00
sunplus phy: usb: sunplus: Fix potential null-ptr-deref in sp_usb_phy_probe() 2023-02-01 08:34:09 +01:00
tegra phy: tegra: xusb: check return value of devm_kzalloc() 2023-07-19 16:21:58 +02:00
ti phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP 2024-02-16 19:06:25 +01:00
xilinx phy: xilinx: zynqmp: Fix bus width setting for SGMII 2022-01-27 10:55:26 +05:30
Kconfig phy: usb: Add USB2.0 phy driver for Sunplus SP7021 2022-09-02 21:01:24 +05:30
Makefile phy: usb: Add USB2.0 phy driver for Sunplus SP7021 2022-09-02 21:01:24 +05:30
phy-can-transceiver.c phy: phy-can-transceiver: Skip warning if no "max-bitrate" 2023-02-01 08:34:25 +01:00
phy-core-mipi-dphy.c phy: dphy: Correct lpx parameter and its derivatives(ta_{get,go,sure}) 2022-02-25 14:14:06 +05:30
phy-core.c phy: core: Warn when phy_power_on is called before phy_init 2022-04-20 14:45:15 +05:30
phy-lgm-usb.c
phy-lpc18xx-usb-otg.c
phy-pistachio-usb.c
phy-xgene.c phy: phy-xgene.c: Fix alignment of comment 2021-05-31 14:08:55 +05:30