Skip to content

Commit d937ecc

Browse files
harini-katakammichalsimek
authored andcommitted
phy: gmii2rgmii: Add check for external phy driver
Add a check for external phy driver to be probed before dereferencing phy driver pointer. This fixes the following crash: [ 2.439334] libphy: MACB_mii_bus: probed [ 2.444797] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 2.452689] Mem abort info: [ 2.455453] Exception class = DABT (current EL), IL = 32 bits [ 2.461334] SET = 0, FnV = 0 [ 2.464361] EA = 0, S1PTW = 0 [ 2.467474] Data abort info: [ 2.470325] ISV = 0, ISS = 0x00000005 [ 2.474135] CM = 0, WnR = 0 [ 2.477077] [0000000000000000] user address but active_mm is swapper [ 2.483392] Internal error: Oops: 96000005 1 SMP [ 2.488232] Modules linked in: [ 2.491261] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.14.0-xilinx-v2018.2 Digilent#1 [ 2.498438] Hardware name: ZynqMP ZC1275 RevB (DT) [ 2.503196] task: ffffffc06d846d00 task.stack: ffffff8008038000 [ 2.509085] PC is at __memcpy+0x100/0x180 [ 2.513061] LR is at xgmiitorgmii_probe+0x7c/0xf0 Signed-off-by: Harini Katakam <[email protected]> Signed-off-by: Michal Simek <[email protected]>
1 parent 047a00b commit d937ecc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/phy/xilinx_gmii2rgmii.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ static int xgmiitorgmii_probe(struct mdio_device *mdiodev)
8181
return -EPROBE_DEFER;
8282
}
8383

84+
if (!priv->phy_dev->drv) {
85+
dev_err(dev, "External PHY driver not probed\n");
86+
return -EPROBE_DEFER;
87+
}
88+
8489
priv->addr = mdiodev->addr;
8590
priv->phy_drv = priv->phy_dev->drv;
8691
memcpy(&priv->conv_phy_drv, priv->phy_dev->drv,

0 commit comments

Comments
 (0)