netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethernet: ti: am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY
@ 2023-01-18 11:21 Siddharth Vadapalli
  2023-01-19 10:30 ` Roger Quadros
  2023-01-20  3:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Siddharth Vadapalli @ 2023-01-18 11:21 UTC (permalink / raw)
  To: davem, edumazet, kuba, linux, pabeni, rogerq, geert
  Cc: netdev, linux-kernel, linux-arm-kernel, srk, s-vadapalli

In the am65_cpsw_init_serdes_phy() function, the error handling for the
call to the devm_of_phy_get() function misses the case where the return
value of devm_of_phy_get() is ERR_PTR(-EPROBE_DEFER). Proceeding without
handling this case will result in a crash when the "phy" pointer with
this value is dereferenced by phy_init() in am65_cpsw_enable_phy().

Fix this by adding appropriate error handling code.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: dab2b265dd23 ("net: ethernet: ti: am65-cpsw: Add support for SERDES configuration")
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
---
This issue has been reported at:
Link: https://lore.kernel.org/r/CAMuHMdWiXu9OJxH4mRnneC3jhqTEcYXek3kbr7svhJ3cnPPwcw@mail.gmail.com/

 drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index 5cac98284184..c696da89962f 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -1463,6 +1463,8 @@ static int am65_cpsw_init_serdes_phy(struct device *dev, struct device_node *por
 	phy = devm_of_phy_get(dev, port_np, name);
 	if (PTR_ERR(phy) == -ENODEV)
 		return 0;
+	if (IS_ERR(phy))
+		return PTR_ERR(phy);
 
 	/* Serdes PHY exists. Store it. */
 	port->slave.serdes_phy = phy;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: ethernet: ti: am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY
  2023-01-18 11:21 [PATCH net-next] net: ethernet: ti: am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY Siddharth Vadapalli
@ 2023-01-19 10:30 ` Roger Quadros
  2023-01-20  3:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Roger Quadros @ 2023-01-19 10:30 UTC (permalink / raw)
  To: Siddharth Vadapalli, davem, edumazet, kuba, linux, pabeni, geert
  Cc: netdev, linux-kernel, linux-arm-kernel, srk



On 18/01/2023 13:21, Siddharth Vadapalli wrote:
> In the am65_cpsw_init_serdes_phy() function, the error handling for the
> call to the devm_of_phy_get() function misses the case where the return
> value of devm_of_phy_get() is ERR_PTR(-EPROBE_DEFER). Proceeding without
> handling this case will result in a crash when the "phy" pointer with
> this value is dereferenced by phy_init() in am65_cpsw_enable_phy().
> 
> Fix this by adding appropriate error handling code.
> 
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Fixes: dab2b265dd23 ("net: ethernet: ti: am65-cpsw: Add support for SERDES configuration")
> Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>

Reviewed-by: Roger Quadros <rogerq@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: ethernet: ti: am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY
  2023-01-18 11:21 [PATCH net-next] net: ethernet: ti: am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY Siddharth Vadapalli
  2023-01-19 10:30 ` Roger Quadros
@ 2023-01-20  3:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-20  3:00 UTC (permalink / raw)
  To: Siddharth Vadapalli
  Cc: davem, edumazet, kuba, linux, pabeni, rogerq, geert, netdev,
	linux-kernel, linux-arm-kernel, srk

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 18 Jan 2023 16:51:36 +0530 you wrote:
> In the am65_cpsw_init_serdes_phy() function, the error handling for the
> call to the devm_of_phy_get() function misses the case where the return
> value of devm_of_phy_get() is ERR_PTR(-EPROBE_DEFER). Proceeding without
> handling this case will result in a crash when the "phy" pointer with
> this value is dereferenced by phy_init() in am65_cpsw_enable_phy().
> 
> Fix this by adding appropriate error handling code.
> 
> [...]

Here is the summary with links:
  - [net-next] net: ethernet: ti: am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY
    https://git.kernel.org/netdev/net-next/c/854617f52ab4

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:[~2023-01-20  3:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-18 11:21 [PATCH net-next] net: ethernet: ti: am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY Siddharth Vadapalli
2023-01-19 10:30 ` Roger Quadros
2023-01-20  3:00 ` 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;
as well as URLs for NNTP newsgroup(s).