From: Quanyang Wang <quanyang.w...@windriver.com> When stmmac is using fixed-link mode, dev->phydev is NULL after calling stmmac_init_phy, so we need to add condition check if dev->phydev is NULL pointer. This patch is to fix the following calltrace:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000435 Mem abort info: ESR = 0x0000000096000005 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x05: level 1 translation fault Data abort info: ISV = 0, ISS = 0x00000005 CM = 0, WnR = 0 user pgtable: 4k pages, 39-bit VAs, pgdp=0000000882fea000 [0000000000000435] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000 Internal error: Oops: 0000000096000005 [#1] PREEMPT_RT SMP Modules linked in: 8021q pfeng(O) s32cc_adc llce_core ci_hdrc_imx usbmisc_imx flexcan firmware_class industrialio_triggered_buffer i2c_imx kfifo_buf pwm_fsl_ftm sch_fq_codel openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 fuse CPU: 5 PID: 375 Comm: dhcpcd Tainted: G O 6.1.62-rt10-yocto-preempt-rt #66 Hardware name: Freescale S32G399A (DT) pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __stmmac_open+0x374/0x418 lr : __stmmac_open+0x370/0x418 sp : ffffffc00c633a50 x29: ffffffc00c633a50 x28: 0000000000001043 x27: ffffff8800371e00 x26: 0000000000000000 x25: 000000000000000a x24: ffffff8802eec240 x23: ffffff8800d8dc10 x22: ffffff8800cae000 x21: 0000000000000000 x20: ffffff88026c8000 x19: ffffff88026c89c0 x18: 0000000000000020 x17: 0000000000000000 x16: 0000000000000000 x15: ffffff8802eec6d8 x14: 0000000000000001 x13: ffffffc0094cfefa x12: ffffffc0094cfef6 x11: 0000000000000040 x10: 000000000000000a x9 : ffffffc0080a5414 x8 : 000000000000000a x7 : 647968703d3d3d3d x6 : 0000000000000000 x5 : ffffff885bfb6ae0 x4 : 0000000000000000 x3 : 0000000000000027 x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000018 Call trace: __stmmac_open+0x374/0x418 stmmac_open+0x48/0xa0 __dev_open+0x10c/0x1c8 __dev_change_flags+0x174/0x1d0 dev_change_flags+0x2c/0x70 devinet_ioctl+0x664/0x738 inet_ioctl+0x1e4/0x1f8 sock_do_ioctl+0x50/0x100 sock_ioctl+0x234/0x358 __arm64_sys_ioctl+0xb0/0xf8 invoke_syscall+0x58/0x120 el0_svc_common.constprop.0+0x4c/0xf8 do_el0_svc+0x34/0xc0 el0_svc+0x2c/0x88 el0t_64_sync_handler+0xb8/0xc0 el0t_64_sync+0x18c/0x190 Code: b0003440 910f6000 940f8975 f9448a81 (3950d420) Signed-off-by: Quanyang Wang <quanyang.w...@windriver.com> --- Hi Bruce, Would you please help merge this patch to the branches: v5.15/standard/preempt-rt/nxp-sdk-5.15/nxp-s32g v5.15/standard/nxp-sdk-5.15/nxp-s32g Thanks, Quanyang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 1816b87020be3..b9c06e17cf1bf 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3840,7 +3840,8 @@ static int stmmac_open(struct net_device *dev) stmmac_enable_all_dma_irq(priv); /* Indicate that the MAC is responsible for PHY PM */ - dev->phydev->mac_managed_pm = true; + if (dev->phydev) + dev->phydev->mac_managed_pm = true; return 0; -- 2.36.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#13422): https://lists.yoctoproject.org/g/linux-yocto/message/13422 Mute This Topic: https://lists.yoctoproject.org/mt/103143892/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-