de8951db10cf10f76cbcc718bd9b09182e34a9eb
[openwrt/staging/jogo.git] /
1 From 9926de7315be3d606cc011a305ad9adb9e8e14c9 Mon Sep 17 00:00:00 2001
2 From: Oleksij Rempel <o.rempel@pengutronix.de>
3 Date: Sat, 18 Jun 2022 14:23:33 +0200
4 Subject: [PATCH] net: phy: at803x: fix NULL pointer dereference on AR9331 PHY
5
6 Latest kernel will explode on the PHY interrupt config, since it depends
7 now on allocated priv. So, run probe to allocate priv to fix it.
8
9 ar9331_switch ethernet.1:10 lan0 (uninitialized): PHY [!ahb!ethernet@1a000000!mdio!switch@10:00] driver [Qualcomm Atheros AR9331 built-in PHY] (irq=13)
10 CPU 0 Unable to handle kernel paging request at virtual address 0000000a, epc == 8050e8a8, ra == 80504b34
11 ...
12 Call Trace:
13 [<8050e8a8>] at803x_config_intr+0x5c/0xd0
14 [<80504b34>] phy_request_interrupt+0xa8/0xd0
15 [<8050289c>] phylink_bringup_phy+0x2d8/0x3ac
16 [<80502b68>] phylink_fwnode_phy_connect+0x118/0x130
17 [<8074d8ec>] dsa_slave_create+0x270/0x420
18 [<80743b04>] dsa_port_setup+0x12c/0x148
19 [<8074580c>] dsa_register_switch+0xaf0/0xcc0
20 [<80511344>] ar9331_sw_probe+0x370/0x388
21 [<8050cb78>] mdio_probe+0x44/0x70
22 [<804df300>] really_probe+0x200/0x424
23 [<804df7b4>] __driver_probe_device+0x290/0x298
24 [<804df810>] driver_probe_device+0x54/0xe4
25 [<804dfd50>] __device_attach_driver+0xe4/0x130
26 [<804dcb00>] bus_for_each_drv+0xb4/0xd8
27 [<804dfac4>] __device_attach+0x104/0x1a4
28 [<804ddd24>] bus_probe_device+0x48/0xc4
29 [<804deb44>] deferred_probe_work_func+0xf0/0x10c
30 [<800a0ffc>] process_one_work+0x314/0x4d4
31 [<800a17fc>] worker_thread+0x2a4/0x354
32 [<800a9a54>] kthread+0x134/0x13c
33 [<8006306c>] ret_from_kernel_thread+0x14/0x1c
34
35 Same Issue would affect some other PHYs (QCA8081, QCA9561), so fix it
36 too.
37
38 Fixes: 3265f4218878 ("net: phy: at803x: add fiber support")
39 Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
40 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
41 Signed-off-by: David S. Miller <davem@davemloft.net>
42 ---
43 drivers/net/phy/at803x.c | 6 ++++++
44 1 file changed, 6 insertions(+)
45
46 --- a/drivers/net/phy/at803x.c
47 +++ b/drivers/net/phy/at803x.c
48 @@ -1594,6 +1594,8 @@ static struct phy_driver at803x_driver[]
49 /* ATHEROS AR9331 */
50 PHY_ID_MATCH_EXACT(ATH9331_PHY_ID),
51 .name = "Qualcomm Atheros AR9331 built-in PHY",
52 + .probe = at803x_probe,
53 + .remove = at803x_remove,
54 .suspend = at803x_suspend,
55 .resume = at803x_resume,
56 .flags = PHY_POLL_CABLE_TEST,