* [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061
@ 2022-05-04 14:31 Fabio Estevam
2022-05-04 14:31 ` [PATCH net v2 2/2] net: phy: micrel: Pass .probe for KS8737 Fabio Estevam
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Fabio Estevam @ 2022-05-04 14:31 UTC (permalink / raw)
To: kuba
Cc: davem, andrew, claudiu.beznea, netdev, o.rempel, linux,
Fabio Estevam, stable
From: Fabio Estevam <festevam@denx.de>
Since commit f1131b9c23fb ("net: phy: micrel: use
kszphy_suspend()/kszphy_resume for irq aware devices") the following
NULL pointer dereference is observed on a board with KSZ8061:
# udhcpc -i eth0
udhcpc: started, v1.35.0
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000008
pgd = f73cef4e
[00000008] *pgd=00000000
Internal error: Oops: 5 [#1] SMP ARM
Modules linked in:
CPU: 0 PID: 196 Comm: ifconfig Not tainted 5.15.37-dirty #94
Hardware name: Freescale i.MX6 SoloX (Device Tree)
PC is at kszphy_config_reset+0x10/0x114
LR is at kszphy_resume+0x24/0x64
...
The KSZ8061 phy_driver structure does not have the .probe/..driver_data
fields, which means that priv is not allocated.
This causes the NULL pointer dereference inside kszphy_config_reset().
Fix the problem by using the generic suspend/resume functions as before.
Another alternative would be to provide the .probe and .driver_data
information into the structure, but to be on the safe side, let's
just restore Ethernet functionality by using the generic suspend/resume.
Cc: stable@vger.kernel.org
Fixes: f1131b9c23fb ("net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices")
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v1:
- Explained why enphy_suspend/resume solution is preferred (Andrew).
drivers/net/phy/micrel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 685a0ab5453c..11cd073630e5 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -3021,8 +3021,8 @@ static struct phy_driver ksphy_driver[] = {
.config_init = ksz8061_config_init,
.config_intr = kszphy_config_intr,
.handle_interrupt = kszphy_handle_interrupt,
- .suspend = kszphy_suspend,
- .resume = kszphy_resume,
+ .suspend = genphy_suspend,
+ .resume = genphy_resume,
}, {
.phy_id = PHY_ID_KSZ9021,
.phy_id_mask = 0x000ffffe,
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net v2 2/2] net: phy: micrel: Pass .probe for KS8737
2022-05-04 14:31 [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061 Fabio Estevam
@ 2022-05-04 14:31 ` Fabio Estevam
2022-05-04 21:52 ` Andrew Lunn
2022-05-04 17:03 ` [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061 Fabio Estevam
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2022-05-04 14:31 UTC (permalink / raw)
To: kuba
Cc: davem, andrew, claudiu.beznea, netdev, o.rempel, linux,
Fabio Estevam, stable
From: Fabio Estevam <festevam@denx.de>
Since commit f1131b9c23fb ("net: phy: micrel: use
kszphy_suspend()/kszphy_resume for irq aware devices") the kszphy_suspend/
resume hooks are used.
These functions require the probe function to be called so that
priv can be allocated.
Otherwise, a NULL pointer dereference happens inside
kszphy_config_reset().
Cc: stable@vger.kernel.org
Fixes: f1131b9c23fb ("net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices")
Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v1:
- Newly introduced. This was noticed by Andrew.
drivers/net/phy/micrel.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 11cd073630e5..a06661c07ca8 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -2896,6 +2896,7 @@ static struct phy_driver ksphy_driver[] = {
.name = "Micrel KS8737",
/* PHY_BASIC_FEATURES */
.driver_data = &ks8737_type,
+ .probe = kszphy_probe,
.config_init = kszphy_config_init,
.config_intr = kszphy_config_intr,
.handle_interrupt = kszphy_handle_interrupt,
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061
2022-05-04 14:31 [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061 Fabio Estevam
2022-05-04 14:31 ` [PATCH net v2 2/2] net: phy: micrel: Pass .probe for KS8737 Fabio Estevam
@ 2022-05-04 17:03 ` Fabio Estevam
2022-05-04 21:53 ` Andrew Lunn
2022-05-04 21:51 ` Andrew Lunn
2022-05-06 1:20 ` patchwork-bot+netdevbpf
3 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2022-05-04 17:03 UTC (permalink / raw)
To: Jakub Kicinski
Cc: David S. Miller, Andrew Lunn, Claudiu Beznea, netdev,
Oleksij Rempel, Russell King - ARM Linux, Fabio Estevam, stable
Hi Andrew,
On Wed, May 4, 2022 at 11:31 AM Fabio Estevam <festevam@gmail.com> wrote:
>
> From: Fabio Estevam <festevam@denx.de>
>
> Since commit f1131b9c23fb ("net: phy: micrel: use
> kszphy_suspend()/kszphy_resume for irq aware devices") the following
> NULL pointer dereference is observed on a board with KSZ8061:
>
> # udhcpc -i eth0
> udhcpc: started, v1.35.0
> 8<--- cut here ---
> Unable to handle kernel NULL pointer dereference at virtual address 00000008
> pgd = f73cef4e
> [00000008] *pgd=00000000
> Internal error: Oops: 5 [#1] SMP ARM
> Modules linked in:
> CPU: 0 PID: 196 Comm: ifconfig Not tainted 5.15.37-dirty #94
> Hardware name: Freescale i.MX6 SoloX (Device Tree)
> PC is at kszphy_config_reset+0x10/0x114
> LR is at kszphy_resume+0x24/0x64
> ...
>
> The KSZ8061 phy_driver structure does not have the .probe/..driver_data
> fields, which means that priv is not allocated.
>
> This causes the NULL pointer dereference inside kszphy_config_reset().
>
> Fix the problem by using the generic suspend/resume functions as before.
>
> Another alternative would be to provide the .probe and .driver_data
> information into the structure, but to be on the safe side, let's
> just restore Ethernet functionality by using the generic suspend/resume.
>
> Cc: stable@vger.kernel.org
> Fixes: f1131b9c23fb ("net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices")
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---
> Changes since v1:
> - Explained why enphy_suspend/resume solution is preferred (Andrew).
If this series gets applied, I plan to submit two patches targeting net-next to:
1. Allow .probe to be called without .data_driver being passed
2. Convert KSZ8061 to use .probe and kszphy_suspend/resume
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061
2022-05-04 14:31 [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061 Fabio Estevam
2022-05-04 14:31 ` [PATCH net v2 2/2] net: phy: micrel: Pass .probe for KS8737 Fabio Estevam
2022-05-04 17:03 ` [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061 Fabio Estevam
@ 2022-05-04 21:51 ` Andrew Lunn
2022-05-06 1:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2022-05-04 21:51 UTC (permalink / raw)
To: Fabio Estevam
Cc: kuba, davem, claudiu.beznea, netdev, o.rempel, linux,
Fabio Estevam, stable
On Wed, May 04, 2022 at 11:31:03AM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
>
> Since commit f1131b9c23fb ("net: phy: micrel: use
> kszphy_suspend()/kszphy_resume for irq aware devices") the following
> NULL pointer dereference is observed on a board with KSZ8061:
>
> # udhcpc -i eth0
> udhcpc: started, v1.35.0
> 8<--- cut here ---
> Unable to handle kernel NULL pointer dereference at virtual address 00000008
> pgd = f73cef4e
> [00000008] *pgd=00000000
> Internal error: Oops: 5 [#1] SMP ARM
> Modules linked in:
> CPU: 0 PID: 196 Comm: ifconfig Not tainted 5.15.37-dirty #94
> Hardware name: Freescale i.MX6 SoloX (Device Tree)
> PC is at kszphy_config_reset+0x10/0x114
> LR is at kszphy_resume+0x24/0x64
> ...
>
> The KSZ8061 phy_driver structure does not have the .probe/..driver_data
> fields, which means that priv is not allocated.
>
> This causes the NULL pointer dereference inside kszphy_config_reset().
>
> Fix the problem by using the generic suspend/resume functions as before.
>
> Another alternative would be to provide the .probe and .driver_data
> information into the structure, but to be on the safe side, let's
> just restore Ethernet functionality by using the generic suspend/resume.
>
> Cc: stable@vger.kernel.org
> Fixes: f1131b9c23fb ("net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices")
> Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net v2 2/2] net: phy: micrel: Pass .probe for KS8737
2022-05-04 14:31 ` [PATCH net v2 2/2] net: phy: micrel: Pass .probe for KS8737 Fabio Estevam
@ 2022-05-04 21:52 ` Andrew Lunn
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2022-05-04 21:52 UTC (permalink / raw)
To: Fabio Estevam
Cc: kuba, davem, claudiu.beznea, netdev, o.rempel, linux,
Fabio Estevam, stable
On Wed, May 04, 2022 at 11:31:04AM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
>
> Since commit f1131b9c23fb ("net: phy: micrel: use
> kszphy_suspend()/kszphy_resume for irq aware devices") the kszphy_suspend/
> resume hooks are used.
>
> These functions require the probe function to be called so that
> priv can be allocated.
>
> Otherwise, a NULL pointer dereference happens inside
> kszphy_config_reset().
>
> Cc: stable@vger.kernel.org
> Fixes: f1131b9c23fb ("net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices")
> Reported-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061
2022-05-04 17:03 ` [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061 Fabio Estevam
@ 2022-05-04 21:53 ` Andrew Lunn
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2022-05-04 21:53 UTC (permalink / raw)
To: Fabio Estevam
Cc: Jakub Kicinski, David S. Miller, Claudiu Beznea, netdev,
Oleksij Rempel, Russell King - ARM Linux, Fabio Estevam, stable
> If this series gets applied, I plan to submit two patches targeting net-next to:
>
> 1. Allow .probe to be called without .data_driver being passed
> 2. Convert KSZ8061 to use .probe and kszphy_suspend/resume
Great.
Please wait at least a week so that net gets merged into net-next, so
there are no merge conflicts.
Thanks
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061
2022-05-04 14:31 [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061 Fabio Estevam
` (2 preceding siblings ...)
2022-05-04 21:51 ` Andrew Lunn
@ 2022-05-06 1:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-06 1:20 UTC (permalink / raw)
To: Fabio Estevam
Cc: kuba, davem, andrew, claudiu.beznea, netdev, o.rempel, linux,
festevam, stable
Hello:
This series was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 4 May 2022 11:31:03 -0300 you wrote:
> From: Fabio Estevam <festevam@denx.de>
>
> Since commit f1131b9c23fb ("net: phy: micrel: use
> kszphy_suspend()/kszphy_resume for irq aware devices") the following
> NULL pointer dereference is observed on a board with KSZ8061:
>
> # udhcpc -i eth0
> udhcpc: started, v1.35.0
> 8<--- cut here ---
> Unable to handle kernel NULL pointer dereference at virtual address 00000008
> pgd = f73cef4e
> [00000008] *pgd=00000000
> Internal error: Oops: 5 [#1] SMP ARM
> Modules linked in:
> CPU: 0 PID: 196 Comm: ifconfig Not tainted 5.15.37-dirty #94
> Hardware name: Freescale i.MX6 SoloX (Device Tree)
> PC is at kszphy_config_reset+0x10/0x114
> LR is at kszphy_resume+0x24/0x64
> ...
>
> [...]
Here is the summary with links:
- [net,v2,1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061
https://git.kernel.org/netdev/net/c/e333eed63a09
- [net,v2,2/2] net: phy: micrel: Pass .probe for KS8737
https://git.kernel.org/netdev/net/c/15f03ffe4bb9
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] 7+ messages in thread
end of thread, other threads:[~2022-05-06 1:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 14:31 [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061 Fabio Estevam
2022-05-04 14:31 ` [PATCH net v2 2/2] net: phy: micrel: Pass .probe for KS8737 Fabio Estevam
2022-05-04 21:52 ` Andrew Lunn
2022-05-04 17:03 ` [PATCH net v2 1/2] net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061 Fabio Estevam
2022-05-04 21:53 ` Andrew Lunn
2022-05-04 21:51 ` Andrew Lunn
2022-05-06 1:20 ` 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).