android_kernel_samsung_sm8650/drivers/phy/ti
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
..
Kconfig phy: ti: fix Kconfig warning and operator precedence 2023-02-01 08:34:08 +01:00
Makefile phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC 2020-01-14 10:50:19 +05:30
phy-am654-serdes.c phy: ti: Add missing pm_runtime_disable() in serdes_am654_probe 2022-04-14 10:38:58 +05:30
phy-da8xx-usb.c
phy-dm816x-usb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 2) 2022-06-10 14:51:35 +02:00
phy-gmii-sel.c phy: ti: gmii-sel: Add support for CPSW5G GMII SEL in J7200 2022-09-13 23:10:26 +05:30
phy-j721e-wiz.c phy: ti: j721e-wiz: Fix unreachable code in wiz_mode_select() 2023-05-11 23:03:37 +09:00
phy-omap-control.c phy: ti: Use IS_ERR_OR_NULL() to clean code 2021-12-14 13:10:03 +05:30
phy-omap-usb2.c phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP 2024-02-16 19:06:25 +01:00
phy-ti-pipe3.c phy: ti: Fix missing of_node_put in ti_pipe3_get_sysctrl() 2022-04-11 22:45:31 +05:30
phy-tusb1210.c phy: ti: tusb1210: Don't check for write errors when powering on 2022-07-05 10:57:32 +05:30
phy-twl4030-usb.c phy: phy-twl4030-usb: Disable PHY for suspend 2021-08-06 17:32:51 +05:30