* [PATCH net 0/2] rswitch: Fix issues on specific conditions
@ 2023-10-10 12:48 Yoshihiro Shimoda
2023-10-10 12:48 ` [PATCH net 1/2] rswitch: Fix renesas_eth_sw_remove() implementation Yoshihiro Shimoda
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2023-10-10 12:48 UTC (permalink / raw)
To: s.shtylyov, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
This patch series fix some issues of rswitch driver on specific
condtions.
Yoshihiro Shimoda (2):
rswitch: Fix renesas_eth_sw_remove() implementation
rswitch: Fix imbalance phy_power_off() calling
drivers/net/ethernet/renesas/rswitch.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/2] rswitch: Fix renesas_eth_sw_remove() implementation
2023-10-10 12:48 [PATCH net 0/2] rswitch: Fix issues on specific conditions Yoshihiro Shimoda
@ 2023-10-10 12:48 ` Yoshihiro Shimoda
2023-10-10 12:48 ` [PATCH net 2/2] rswitch: Fix imbalance phy_power_off() calling Yoshihiro Shimoda
2023-10-12 9:30 ` [PATCH net 0/2] rswitch: Fix issues on specific conditions patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2023-10-10 12:48 UTC (permalink / raw)
To: s.shtylyov, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
Fix functions calling order and a condition in renesas_eth_sw_remove().
Otherwise, kernel NULL pointer dereference happens from phy_stop() if
a net device opens.
Fixes: 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas•com>
---
drivers/net/ethernet/renesas/rswitch.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index fc01ad3f340d..4d7c48288047 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1964,15 +1964,17 @@ static void rswitch_deinit(struct rswitch_private *priv)
rswitch_gwca_hw_deinit(priv);
rcar_gen4_ptp_unregister(priv->ptp_priv);
- for (i = 0; i < RSWITCH_NUM_PORTS; i++) {
+ rswitch_for_each_enabled_port(priv, i) {
struct rswitch_device *rdev = priv->rdev[i];
- phy_exit(priv->rdev[i]->serdes);
- rswitch_ether_port_deinit_one(rdev);
unregister_netdev(rdev->ndev);
- rswitch_device_free(priv, i);
+ rswitch_ether_port_deinit_one(rdev);
+ phy_exit(priv->rdev[i]->serdes);
}
+ for (i = 0; i < RSWITCH_NUM_PORTS; i++)
+ rswitch_device_free(priv, i);
+
rswitch_gwca_ts_queue_free(priv);
rswitch_gwca_linkfix_free(priv);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] rswitch: Fix imbalance phy_power_off() calling
2023-10-10 12:48 [PATCH net 0/2] rswitch: Fix issues on specific conditions Yoshihiro Shimoda
2023-10-10 12:48 ` [PATCH net 1/2] rswitch: Fix renesas_eth_sw_remove() implementation Yoshihiro Shimoda
@ 2023-10-10 12:48 ` Yoshihiro Shimoda
2023-10-12 9:30 ` [PATCH net 0/2] rswitch: Fix issues on specific conditions patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2023-10-10 12:48 UTC (permalink / raw)
To: s.shtylyov, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
The phy_power_off() should not be called if phy_power_on() failed.
So, add a condition .power_count before calls phy_power_off().
Fixes: 5cb630925b49 ("net: renesas: rswitch: Add phy_power_{on,off}() calling")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas•com>
---
drivers/net/ethernet/renesas/rswitch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 4d7c48288047..0fc0b6bea753 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1254,7 +1254,7 @@ static void rswitch_adjust_link(struct net_device *ndev)
phy_print_status(phydev);
if (phydev->link)
phy_power_on(rdev->serdes);
- else
+ else if (rdev->serdes->power_count)
phy_power_off(rdev->serdes);
rdev->etha->link = phydev->link;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 0/2] rswitch: Fix issues on specific conditions
2023-10-10 12:48 [PATCH net 0/2] rswitch: Fix issues on specific conditions Yoshihiro Shimoda
2023-10-10 12:48 ` [PATCH net 1/2] rswitch: Fix renesas_eth_sw_remove() implementation Yoshihiro Shimoda
2023-10-10 12:48 ` [PATCH net 2/2] rswitch: Fix imbalance phy_power_off() calling Yoshihiro Shimoda
@ 2023-10-12 9:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-12 9:30 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: s.shtylyov, davem, edumazet, kuba, pabeni, netdev,
linux-renesas-soc
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat•com>:
On Tue, 10 Oct 2023 21:48:56 +0900 you wrote:
> This patch series fix some issues of rswitch driver on specific
> condtions.
>
> Yoshihiro Shimoda (2):
> rswitch: Fix renesas_eth_sw_remove() implementation
> rswitch: Fix imbalance phy_power_off() calling
>
> [...]
Here is the summary with links:
- [net,1/2] rswitch: Fix renesas_eth_sw_remove() implementation
https://git.kernel.org/netdev/net/c/510b18cf23b9
- [net,2/2] rswitch: Fix imbalance phy_power_off() calling
https://git.kernel.org/netdev/net/c/053f13f67be6
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] 4+ messages in thread
end of thread, other threads:[~2023-10-12 9:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10 12:48 [PATCH net 0/2] rswitch: Fix issues on specific conditions Yoshihiro Shimoda
2023-10-10 12:48 ` [PATCH net 1/2] rswitch: Fix renesas_eth_sw_remove() implementation Yoshihiro Shimoda
2023-10-10 12:48 ` [PATCH net 2/2] rswitch: Fix imbalance phy_power_off() calling Yoshihiro Shimoda
2023-10-12 9:30 ` [PATCH net 0/2] rswitch: Fix issues on specific conditions 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