]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061
authorFabio Estevam <festevam@denx.de>
Wed, 4 May 2022 14:31:03 +0000 (11:31 -0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 6 May 2022 00:02:02 +0000 (17:02 -0700)
commit3158b9f5688884ca0f898030120c517f68beb4f3
tree680962c6dac07b37074858ed35aef225acbb7936
parent9c13160a95cd7d76780b65b156fa42675acc816d
net: phy: micrel: Do not use kszphy_suspend/resume for KSZ8061

Since commit 39560238d8ed ("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: 39560238d8ed ("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>
Link: https://lore.kernel.org/r/20220504143104.1286960-1-festevam@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/micrel.c