* [PATCH v2 net] net: lan966x: fix kernel oops on ioctl when I/F is down
@ 2022-03-28 22:03 Michael Walle
2022-03-29 1:02 ` Andrew Lunn
2022-03-29 9:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Michael Walle @ 2022-03-28 22:03 UTC (permalink / raw)
To: Horatiu Vultur, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: UNGLinuxDriver, netdev, linux-kernel, Michael Walle
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: 735fec995b21 ("net: lan966x: Implement SIOCSHWTSTAMP and SIOCGHWTSTAMP")
Signed-off-by: Michael Walle <michael@walle.cc>
---
changes since v1:
- reword commit message
- test for the presence of phydev instead of the interface state
- move the test just before phy_mii_ioctl()
drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index ec42e526f6fb..1759b0e2b56f 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -408,6 +408,9 @@ static int lan966x_port_ioctl(struct net_device *dev, struct ifreq *ifr,
}
}
+ if (!dev->phydev)
+ return -ENODEV;
+
return phy_mii_ioctl(dev->phydev, ifr, cmd);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net] net: lan966x: fix kernel oops on ioctl when I/F is down
2022-03-28 22:03 [PATCH v2 net] net: lan966x: fix kernel oops on ioctl when I/F is down Michael Walle
@ 2022-03-29 1:02 ` Andrew Lunn
2022-03-29 9:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2022-03-29 1:02 UTC (permalink / raw)
To: Michael Walle
Cc: Horatiu Vultur, David S . Miller, Jakub Kicinski, Paolo Abeni,
UNGLinuxDriver, netdev, linux-kernel
On Tue, Mar 29, 2022 at 12:03:50AM +0200, Michael Walle wrote:
> 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: 735fec995b21 ("net: lan966x: Implement SIOCSHWTSTAMP and SIOCGHWTSTAMP")
> Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net] net: lan966x: fix kernel oops on ioctl when I/F is down
2022-03-28 22:03 [PATCH v2 net] net: lan966x: fix kernel oops on ioctl when I/F is down Michael Walle
2022-03-29 1:02 ` Andrew Lunn
@ 2022-03-29 9:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-29 9:20 UTC (permalink / raw)
To: Michael Walle
Cc: horatiu.vultur, davem, kuba, pabeni, UNGLinuxDriver, netdev,
linux-kernel
Hello:
This patch was applied to netdev/net.git (master)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 29 Mar 2022 00:03:50 +0200 you wrote:
> 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: 735fec995b21 ("net: lan966x: Implement SIOCSHWTSTAMP and SIOCGHWTSTAMP")
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> changes since v1:
> - reword commit message
> - test for the presence of phydev instead of the interface state
> - move the test just before phy_mii_ioctl()
>
> [...]
Here is the summary with links:
- [v2,net] net: lan966x: fix kernel oops on ioctl when I/F is down
https://git.kernel.org/netdev/net/c/ad7da1ce5749
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] 3+ messages in thread
end of thread, other threads:[~2022-03-29 9:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 22:03 [PATCH v2 net] net: lan966x: fix kernel oops on ioctl when I/F is down Michael Walle
2022-03-29 1:02 ` Andrew Lunn
2022-03-29 9:20 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.