linux/drivers/phy
Tony Lindgren 7104ba0f19 phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP
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>
2024-01-30 22:41:11 +05:30
..
allwinner phy: sun4i-usb: update array size 2023-10-13 15:34:39 +05:30
amlogic phy: amlogic: meson-g12a-usb2: fix Wvoid-pointer-to-enum-cast warning 2023-08-22 19:28:10 +05:30
broadcom phy: Use device_get_match_data() 2023-10-13 15:45:40 +05:30
cadence phy: Explicitly include correct DT includes 2023-07-17 11:52:56 +05:30
freescale phy: lynx-28g: serialize concurrent phy_set_mode_ext() calls to shared registers 2023-10-06 10:59:52 +01:00
hisilicon phy-for-6.6 2023-09-03 10:38:02 -07:00
ingenic phy: Explicitly include correct DT includes 2023-07-17 11:52:56 +05:30
intel phy-for-6.4 2023-05-03 11:17:34 -07:00
lantiq phy: Explicitly include correct DT includes 2023-07-17 11:52:56 +05:30
marvell phy: Use device_get_match_data() 2023-10-13 15:45:40 +05:30
mediatek phy-for-6.8 2024-01-18 17:11:43 -08:00
microchip phy: lan966x: Add missing serdes mux entry 2024-01-24 11:24:29 +05:30
motorola phy: Drop unnecessary of_match_device() calls 2023-10-13 15:47:53 +05:30
mscc phy: phy-ocelot-serdes: add ability to be used in a non-syscon configuration 2023-03-20 09:08:48 +00:00
qualcomm phy: qcom-qmp-usb: fix serdes init sequence for IPQ6018 2024-01-24 11:11:52 +05:30
ralink phy: Remove duplicated include in phy-ralink-usb.c 2023-10-23 11:55:36 +05:30
renesas phy: renesas: rcar-gen3-usb2: Fix returning wrong error code 2024-01-24 11:22:20 +05:30
rockchip phy: phy-rockchip-inno-usb2: Add RK3128 support 2023-11-27 18:36:29 +05:30
samsung phy: exynos5-usbdrd: Add Exynos850 support 2023-08-22 19:41:15 +05:30
socionext phy: Explicitly include correct DT includes 2023-07-17 11:52:56 +05:30
st phy: Explicitly include correct DT includes 2023-07-17 11:52:56 +05:30
starfive phy: starfive: StarFive PHYs should depend on ARCH_STARFIVE 2023-07-26 19:09:08 +05:30
sunplus phy: sunplus: return negative error code in sp_usb_phy_probe 2023-11-27 18:39:18 +05:30
tegra phy: Remove duplicated include in xusb.c 2023-07-24 16:24:19 +05:30
ti phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP 2024-01-30 22:41:11 +05:30
xilinx phy: zynqmp: Allow variation in refclk rate 2023-07-12 22:27:44 +05:30
Kconfig Revert "phy: realtek: usb: Add driver for the Realtek SoC USB 2.0 PHY" 2023-11-06 14:47:36 +01:00
Makefile Revert "phy: realtek: usb: Add driver for the Realtek SoC USB 2.0 PHY" 2023-11-06 14:47:36 +01:00
phy-can-transceiver.c phy: phy-can-transceiver: insert space after include 2023-12-21 22:39:59 +05:30
phy-core-mipi-dphy.c phy: dphy: add support to calculate the timing based on hs_clk_rate 2022-10-27 14:38:04 +03:00
phy-core.c phy: core: Remove usage of the deprecated ida_simple_xx() API 2023-11-16 17:03:51 +05:30
phy-lgm-usb.c phy: phy-lgm-usb: Convert to platform remove callback returning void 2023-03-20 18:14:56 +05:30
phy-lpc18xx-usb-otg.c
phy-pistachio-usb.c
phy-xgene.c phy: Explicitly include correct DT includes 2023-07-17 11:52:56 +05:30