[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190304233622.13981-1-pakki001@umn.edu>
Date: Mon, 4 Mar 2019 17:36:22 -0600
From: Aditya Pakki <pakki001@....edu>
To: pakki001@....edu
Cc: kjlu@....edu, Doug Berger <opendmb@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] net: ethernet: Fix phy_set_max_speed by checking for NULL
phy_device can be a NULL pointer which is further dereferenced
downstream in phy_set_max_speed. This patch avoids such a scenario.
Signed-off-by: Aditya Pakki <pakki001@....edu>
---
drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index aceb9b7b55bd..7eaaecb53aa2 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -213,6 +213,8 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
break;
case PHY_INTERFACE_MODE_MII:
+ if (!phydev)
+ return -ENODEV;
phy_name = "external MII";
phy_set_max_speed(phydev, SPEED_100);
bcmgenet_sys_writel(priv,
--
2.17.1
Powered by blists - more mailing lists