Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
phy: Add null check before calling adjust link
Issue: phydev->adjust_link can be NULL in case of phy which generates link down interrupt after phy_stop is called. This interrupt causes a race condition, with adjust link being set to NULL when we get an interrupt and simultaneously phy is getting disconnected. [ 2683.554983] libphy: Calling adjust link, up = 0 [ 2683.559652] ether_adjust_link, 1100, disconnect [ 2683.564750] nvethernet 6810000.ethernet eth2: Link is Down [ 2683.571863] phy_state_machine Calling phy suspend [ 2683.577192] Calling phy disconnect from close [ 2683.580703] Intr handler, state machine [ 2683.586079] libphy: Calling adjust link, up = 0 [ 2683.586108] libphy: phy_disconnect adjust link = NULL [ 2683.590749] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 2683.595942] libphy: phy_detach, 1667 [ 2683.604958] Mem abort info: [ 2683.604959] ESR = 0x86000004 [ 2683.604961] EC = 0x21: IABT (current EL), IL = 32 bits [ 2683.608629] libphy: phy_detach, 1671 [ 2683.608630] libphy: phy_detach, 1674 [ 2683.611496] SET = 0, FnV = 0 [ 2683.611498] EA = 0, S1PTW = 0 [ 2683.633773] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000107bf0000 [ 2683.640380] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000 [ 2683.647372] Internal error: Oops: 86000004 [OE4T#1] PREEMPT SMP [ 2683.653093] Modules linked in: [ 2683.656235] CPU: 6 PID: 1219 Comm: kworker/u16:0 Tainted: G W 5.10.120-tegra OE4T#10 [ 2683.665174] Hardware name: Unknown Jetson AGX Orin/Jetson AGX Orin, BIOS 0.0-ff9214ce 12/20/2022 [ 2683.674218] Workqueue: events_power_efficient phy_state_machine [ 2683.680299] pstate: 60c00009 (nZCv daif +PAN +UAO -TCO BTYPE=--) [ 2683.686467] pc : 0x0 [ 2683.688710] lr : phy_link_change+0x50/0xb0 [ 2683.692908] sp : ffff800016dc3d20 [ 2683.696303] x29: ffff800016dc3d20 x28: ffffb676a7a26000 [ 2683.701762] x27: ffff7513c014f470 x26: ffff7513c014f420 [ 2683.707218] x25: 0000000000000000 x24: ffff7513c7ebe800 [ 2683.712681] x23: ffff7513c6aa0000 x22: ffff7513c7ebecf8 [ 2683.718137] x21: 0000000000000000 x20: ffff7513c6aa0000 [ 2683.723593] x19: ffff7513c7ebe800 x18: 0000000000000010 [ 2683.729047] x17: 0000000000000000 x16: 0000000000000000 [ 2683.734507] x15: ffff7513c7f61470 x14: ffffffffffffffff [ 2683.739958] x13: ffff800096dc3a17 x12: ffff800016dc3a1f [ 2683.745419] x11: 0000000000000000 x10: ffffb676a7aa0aa0 [ 2683.750882] x9 : ffffb676a5bbba7c x8 : 20676e696c6c6143 [ 2683.756336] x7 : 203a79687062696c x6 : 000000000000000a [ 2683.761788] x5 : 0000000000000002 x4 : 0000000000000000 [ 2683.767245] x3 : 00000000ffffffff x2 : 0000000000000000 [ 2683.772697] x1 : 0000000000000000 x0 : ffff7513c6aa0000 [ 2683.778154] Call trace: [ 2683.780664] 0x0 [ 2683.782549] phy_state_machine+0x194/0x260 [ 2683.786756] process_one_work+0x1c4/0x4d0 [ 2683.790882] worker_thread+0x54/0x430 [ 2683.794630] kthread+0x148/0x180 [ 2683.797950] ret_from_fork+0x10/0x34 [ 2683.801626] Code: bad PC value [ 2683.804774] ---[ end trace e61974d923004c5a ]--- [ 2683.809521] Kernel panic - not syncing: Oops: Fatal exception [ 2683.815741] Kernel Offset: 0x367695aa0000 from 0xffff800010000000 [ 2683.821999] PHYS_OFFSET: 0xffff8aed40000000 [ 2683.826290] CPU features: 0x081c0146,4a80aa38 [ 2683.830767] Memory Limit: none [ 2683.833895] ---[ end Kernel panic - not syncing: Oops: Fatal exception ]--- Fix: Add a null check before calling adjust_link callback. Bug 3877272 Bug 3920560 Change-Id: I2843ff746a92bf23349628a02b32a4f16eea0ce1 Signed-off-by: Sushil Kumar Singh <[email protected]> Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2835744 (Cherry-picked from commit 009bebb6905f0d8040592007ce5f16f20212cf75) Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2857069 Reviewed-by: Wayne Wang (SW-TEGRA) <[email protected]> Reviewed-by: Bibek Basu <[email protected]> GVS: Gerrit_Virtual_Submit <[email protected]> Tested-by: Wayne Wang (SW-TEGRA) <[email protected]>
- Loading branch information