[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231120093256.3642327-1-lukas.funke-oss@weidmueller.com>
Date: Mon, 20 Nov 2023 10:32:54 +0100
From: Lukas Funke <lukas.funke-oss@...dmueller.com>
To: Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: Lukas Funke <lukas.funke@...dmueller.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] net: phy: Fix potential null pointer access
From: Lukas Funke <lukas.funke@...dmueller.com>
When there is no driver associated with the phydev, there will be a
nullptr access. The commit checks if the phydev driver is set before
access.
Signed-off-by: Lukas Funke <lukas.funke@...dmueller.com>
---
drivers/net/phy/phy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1135e63a4a76..4de83e3cab77 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -136,7 +136,7 @@ EXPORT_SYMBOL(phy_print_status);
static int phy_config_interrupt(struct phy_device *phydev, bool interrupts)
{
phydev->interrupts = interrupts ? 1 : 0;
- if (phydev->drv->config_intr)
+ if (phydev->drv && phydev->drv->config_intr)
return phydev->drv->config_intr(phydev);
return 0;
--
2.30.2
Powered by blists - more mailing lists