* [PATCH net-next] net: phylink: fix NULL pointer deref in phylink_major_config()
@ 2026-01-28 10:51 Russell King (Oracle)
2026-01-30 2:50 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Russell King (Oracle) @ 2026-01-28 10:51 UTC (permalink / raw)
To: Andrew Lunn
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev,
Paolo Abeni
When a MAC driver returns a PCS for an interface mode, and then we
attempt to switch to a different mode that doesn't require a PCS,
this causes phylink to oops:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
Mem abort info:
ESR = 0x0000000096000044
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000044, ISS2 = 0x00000000
CM = 0, WnR = 1, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=0000000137f96000
[0000000000000010] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 0000000096000044 [#1] SMP
Modules linked in: --
CPU: 1 UID: 0 PID: 55 Comm: kworker/u33:0 Not tainted 6.19.0-rc5-00581-g73cb8467a63e #1 PREEMPT
Hardware name: Qualcomm Technologies, Inc. Lemans Ride Rev3 (DT)
Workqueue: events_power_efficient phylink_resolve
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS +BTYPE=--)
pc : phylink_major_config+0x408/0x948
lr : phylink_major_config+0x3fc/0x948
sp : ffff800080353c60
x29: ffff800080353cb0 x28: ffffb305068a8a00 x27: ffffb305068a8000
x26: ffff000080092100 x25: 0000000000000000 x24: 0000000000000000
x23: 0000000000000001 x22: 0000000000000000 x21: ffffb3050555b3d0
x20: ffff800080353d10 x19: ffff0000b6059400 x18: 00000000ffffffff
x17: 74756f2f79687020 x16: ffffb305045e4f18 x15: 6769666e6f632072
x14: 6f6a616d203a3168 x13: 782d657361623030 x12: ffffb305068c6a98
x11: 0000000000000583 x10: 0000000000000018 x9 : ffffb305068c6a98
x8 : 0000000100006583 x7 : 0000000000000000 x6 : ffff00008083cc40
x5 : ffff00008083cc40 x4 : 0000000000000001 x3 : 0000000000000001
x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0000b269e5a8
Call trace:
phylink_major_config+0x408/0x948 (P)
phylink_resolve+0x294/0x6e4
process_one_work+0x148/0x28c
worker_thread+0x2d8/0x3d8
kthread+0x134/0x208
ret_from_fork+0x10/0x20
Code: d63f0020 f9400e60 b4000040 f900081f (f9000ad3)
---[ end trace 0000000000000000 ]---
This is caused by "pcs" being NULL when we attempt to execute:
pcs->phylink = pl;
Make this conditional on pcs being non-null.
Fixes: 486dc391ef43 ("net: phylink: allow mac_select_pcs() to remove a PCS")
Reported-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Even though this is marked with a Fixes tag, and has been noticed by
Mohd while testing my other PCS patches, I would like it merged into
net-next rather than net so Mohd doesn't have to apply this in
addition to my series when testing. This isn't a bug that will be
seen by others.
drivers/net/phy/phylink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 7641f1f41e39..e1f01d7fc4da 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1293,7 +1293,8 @@ static void phylink_major_config(struct phylink *pl, bool restart,
if (pl->pcs)
pl->pcs->phylink = NULL;
- pcs->phylink = pl;
+ if (pcs)
+ pcs->phylink = pl;
pl->pcs = pcs;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net-next] net: phylink: fix NULL pointer deref in phylink_major_config()
2026-01-28 10:51 [PATCH net-next] net: phylink: fix NULL pointer deref in phylink_major_config() Russell King (Oracle)
@ 2026-01-30 2:50 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-30 2:50 UTC (permalink / raw)
To: Russell King; +Cc: andrew, davem, edumazet, kuba, netdev, pabeni
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 28 Jan 2026 10:51:56 +0000 you wrote:
> When a MAC driver returns a PCS for an interface mode, and then we
> attempt to switch to a different mode that doesn't require a PCS,
> this causes phylink to oops:
>
> Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
> Mem abort info:
> ESR = 0x0000000096000044
> EC = 0x25: DABT (current EL), IL = 32 bits
> SET = 0, FnV = 0
> EA = 0, S1PTW = 0
> FSC = 0x04: level 0 translation fault
> Data abort info:
> ISV = 0, ISS = 0x00000044, ISS2 = 0x00000000
> CM = 0, WnR = 1, TnD = 0, TagAccess = 0
> GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
> user pgtable: 4k pages, 48-bit VAs, pgdp=0000000137f96000
> [0000000000000010] pgd=0000000000000000, p4d=0000000000000000
> Internal error: Oops: 0000000096000044 [#1] SMP
> Modules linked in: --
> CPU: 1 UID: 0 PID: 55 Comm: kworker/u33:0 Not tainted 6.19.0-rc5-00581-g73cb8467a63e #1 PREEMPT
> Hardware name: Qualcomm Technologies, Inc. Lemans Ride Rev3 (DT)
> Workqueue: events_power_efficient phylink_resolve
> pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS +BTYPE=--)
> pc : phylink_major_config+0x408/0x948
> lr : phylink_major_config+0x3fc/0x948
> sp : ffff800080353c60
> x29: ffff800080353cb0 x28: ffffb305068a8a00 x27: ffffb305068a8000
> x26: ffff000080092100 x25: 0000000000000000 x24: 0000000000000000
> x23: 0000000000000001 x22: 0000000000000000 x21: ffffb3050555b3d0
> x20: ffff800080353d10 x19: ffff0000b6059400 x18: 00000000ffffffff
> x17: 74756f2f79687020 x16: ffffb305045e4f18 x15: 6769666e6f632072
> x14: 6f6a616d203a3168 x13: 782d657361623030 x12: ffffb305068c6a98
> x11: 0000000000000583 x10: 0000000000000018 x9 : ffffb305068c6a98
> x8 : 0000000100006583 x7 : 0000000000000000 x6 : ffff00008083cc40
> x5 : ffff00008083cc40 x4 : 0000000000000001 x3 : 0000000000000001
> x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0000b269e5a8
> Call trace:
> phylink_major_config+0x408/0x948 (P)
> phylink_resolve+0x294/0x6e4
> process_one_work+0x148/0x28c
> worker_thread+0x2d8/0x3d8
> kthread+0x134/0x208
> ret_from_fork+0x10/0x20
> Code: d63f0020 f9400e60 b4000040 f900081f (f9000ad3)
>
> [...]
Here is the summary with links:
- [net-next] net: phylink: fix NULL pointer deref in phylink_major_config()
https://git.kernel.org/netdev/net-next/c/0e4d7df2f3b2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-30 2:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-28 10:51 [PATCH net-next] net: phylink: fix NULL pointer deref in phylink_major_config() Russell King (Oracle)
2026-01-30 2:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox