aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-07-11 19:40:13 +0200
committerTom Rini <trini@konsulko.com>2022-08-08 11:37:57 -0400
commitebb8ff61ad97bd1c9721b049497ddb80030eeb0f (patch)
tree0a3b95ddd647b84b14923a3efcd0247f047b53d5 /drivers/net/phy
parent8a3b69d2f257570afef273a579a8b22ec4160e9f (diff)
downloadu-boot-ebb8ff61ad97bd1c9721b049497ddb80030eeb0f.zip
u-boot-ebb8ff61ad97bd1c9721b049497ddb80030eeb0f.tar.gz
u-boot-ebb8ff61ad97bd1c9721b049497ddb80030eeb0f.tar.bz2
net: phy: possible NULL dereference in fixed_phy_create()
We check if phydev is NULL. Only but if it is non-NULL we set one component of phydev. But even if it is NULL we set another. We should not dereference NULL in either case. Fixes: e24b58f5ed4f ("net: phy: don't require PHY interface mode during PHY creation") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Marek BehĂșn <kabel@kernel.org>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/phy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index e6e1755..0350afd 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -984,10 +984,10 @@ struct phy_device *fixed_phy_create(ofnode node)
}
phydev = phy_device_create(NULL, 0, PHY_FIXED_ID, false);
- if (phydev)
+ if (phydev) {
phydev->node = subnode;
-
- phydev->interface = ofnode_read_phy_mode(node);
+ phydev->interface = ofnode_read_phy_mode(node);
+ }
return phydev;
}