[openwrt/openwrt] qca-nss-dp: fix oops in nss_dp_probe
LEDE Commits
lede-commits at lists.infradead.org
Tue Jun 13 07:49:46 PDT 2023
ynezz pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/03455e79d7a4a0da5399618851168dfadebf416e
commit 03455e79d7a4a0da5399618851168dfadebf416e
Author: Petr Štetiar <ynezz at true.cz>
AuthorDate: Mon May 29 19:27:15 2023 +0200
qca-nss-dp: fix oops in nss_dp_probe
Currently kernel crashes when of_phy_connect has issues:
Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000308
...
pc : phy_attached_print+0x28/0x1b0
lr : phy_attached_info+0x14/0x20
...
Call trace:
phy_attached_print+0x28/0x1b0
phy_attached_info+0x14/0x20
nss_dp_adjust_link+0x544/0x6c4 [qca_nss_dp]
of_phy_connect returns either pointer or NULL, so can't be checked with
IS_ERR macro.
Signed-off-by: Petr Štetiar <ynezz at true.cz>
(cherry picked from commit 38c7cf0e69aeefdec44d513307732e4daf7d9794)
---
.../0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch b/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch
index ba9b8ef262..276c87adfc 100644
--- a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch
+++ b/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch
@@ -155,11 +155,12 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
- dp_priv->phydev = phy_connect(netdev, phy_id,
- &nss_dp_adjust_link,
- dp_priv->phy_mii_type);
+- if (IS_ERR(dp_priv->phydev)) {
+- netdev_dbg(netdev, "failed to connect to phy device\n");
+ dp_priv->phydev = of_phy_connect(netdev, dp_priv->phy_node,
+ &nss_dp_adjust_link, 0,
+ dp_priv->phy_mii_type);
- if (IS_ERR(dp_priv->phydev)) {
-- netdev_dbg(netdev, "failed to connect to phy device\n");
++ if (!(dp_priv->phydev)) {
+ dev_err(&pdev->dev, "Could not attach to PHY\n");
goto phy_setup_fail;
}
More information about the lede-commits
mailing list