Skip to content

Commit ad7da1c

Browse files
mwallePaolo Abeni
authored andcommitted
net: lan966x: fix kernel oops on ioctl when I/F is down
ioctls handled by phy_mii_ioctl() will cause a kernel oops when the interface is down. Fix it by making sure there is a PHY attached. Fixes: 735fec9 ("net: lan966x: Implement SIOCSHWTSTAMP and SIOCGHWTSTAMP") Signed-off-by: Michael Walle <michael@walle.cc> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/20220328220350.3118969-1-michael@walle.cc Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 807ca64 commit ad7da1c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/net/ethernet/microchip/lan966x/lan966x_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@ static int lan966x_port_ioctl(struct net_device *dev, struct ifreq *ifr,
408408
}
409409
}
410410

411+
if (!dev->phydev)
412+
return -ENODEV;
413+
411414
return phy_mii_ioctl(dev->phydev, ifr, cmd);
412415
}
413416

0 commit comments

Comments
 (0)