airoha: fix PHY_DETACH_NO_HW_RESET patch panic
Fix kernel panic caused by downstream PHY_DETACH_NO_HW_RESET patch.
[ 20.994001] airoha_eth
1fb50000.ethernet wan: validation of usxgmii with support 00,
00000000,
00000000,
00006000 and advertisement 00,
00000000,
00000000,
00006000 failed: -EINVAL
[ 21.058106] Unable to handle kernel access to user memory outside uaccess routines at virtual address
00000000000000b8
[ 21.068879] Mem abort info:
[ 21.071684] ESR = 0x0000000096000005
[ 21.075436] EC = 0x25: DABT (current EL), IL = 32 bits
[ 21.080790] SET = 0, FnV = 0
[ 21.083854] EA = 0, S1PTW = 0
[ 21.086997] FSC = 0x05: level 1 translation fault
[ 21.091931] Data abort info:
[ 21.094829] ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
[ 21.100359] CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[ 21.105419] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[ 21.110762] user pgtable: 4k pages, 39-bit VAs, pgdp=
0000000091bc8000
[ 21.117218] [
00000000000000b8] pgd=
0800000084ee9003, p4d=
0800000084ee9003, pud=
0800000084ee9003, pmd=
0000000000000000
[ 21.127892] Internal error: Oops:
0000000096000005 [#1] SMP
[ 21.133483] Modules linked in: pppoe ppp_async nft_fib_inet nf_flow_table_inet pppox ppp_generic nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_redir nft_quota nft_numgen nft_nat nft_masq nfte
[ 21.191941] CPU: 3 UID: 0 PID: 1882 Comm: netifd Tainted: G O 6.12.57 #0
[ 21.200046] Tainted: [O]=OOT_MODULE
[ 21.203534] Hardware name: Gemtek W1700K (DT)
[ 21.207892] pstate:
60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 21.214861] pc : phy_detach+0xe8/0x194
[ 21.218628] lr : phy_detach+0xe4/0x194
[ 21.222387] sp :
ffffffc0823ebae0
[ 21.225702] x29:
ffffffc0823ebae0 x28:
ffffff8005451c00 x27:
0000000000000000
[ 21.232846] x26:
0000000000000000 x25:
0000000000001003 x24:
ffffffc080cf8240
[ 21.239990] x23:
0000000000001002 x22:
ffffff807fc527f8 x21:
ffffffc080c93318
[ 21.247125] x20:
ffffff8001cfc000 x19:
ffffff80036f7000 x18:
ffffff8012cde323
[ 21.254269] x17:
303a302d30333537 x16:
000000000000000e x15:
0000005139b64de4
[ 21.261413] x14:
0000000000000001 x13:
ffffff80020b46c0 x12:
0000000000000001
[ 21.268550] x11:
ffffff80020b46c0 x10:
ffffff8005451cc0 x9 :
ffffff807dbf5200
[ 21.275694] x8 :
ffffff80020b46c0 x7 :
ffffff80010a8ed0 x6 :
0000000000000000
[ 21.282838] x5 :
00000000000013f8 x4 :
0000000000000000 x3 :
ffffff8005451c00
[ 21.289983] x2 :
0000000000000000 x1 :
ffffff8005451c00 x0 :
0000000000000000
[ 21.297128] Call trace:
[ 21.299575] phy_detach+0xe8/0x194
[ 21.302988] phylink_fwnode_phy_connect+0x194/0x1c0
[ 21.307874] phylink_of_phy_connect+0x18/0x20
[ 21.312248] airoha_dev_open+0x44/0x2b0
[ 21.316094] __dev_open+0xe8/0x15c
[ 21.319505] __dev_change_flags+0x154/0x1c0
[ 21.323698] dev_change_flags+0x20/0x64
[ 21.327541] dev_ifsioc+0x28c/0x444
[ 21.331032] dev_ioctl+0x290/0x4b8
[ 21.334434] sock_ioctl+0x31c/0x444
[ 21.337923] __arm64_sys_ioctl+0x354/0xe60
[ 21.342020] invoke_syscall.constprop.0+0x58/0xec
[ 21.346725] do_el0_svc+0x3c/0xd4
[ 21.350041] el0_svc+0x18/0x60
[ 21.353097] el0t_64_sync_handler+0x118/0x124
[ 21.357455] el0t_64_sync+0x150/0x154
Make sure the phydev have a driver before asserting a signal or we would
dereference a NULL address.
Signed-off-by: Balázs Triszka <[email protected]>
[ improve commit description ]
Link: https://github.com/openwrt/openwrt/pull/20740
Signed-off-by: Christian Marangi <[email protected]>