[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240710114232.257190-2-kory.maincent@bootlin.com>
Date: Wed, 10 Jul 2024 13:42:31 +0200
From: Kory Maincent <kory.maincent@...tlin.com>
To: Andrew Lunn <andrew@...n.ch>,
Jakub Kicinski <kuba@...nel.org>,
"Kory Maincent (Dent Project)" <kory.maincent@...tlin.com>,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: thomas.petazzoni@...tlin.com,
Oleksij Rempel <o.rempel@...gutronix.de>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>
Subject: [PATCH v2 2/2] net: ethtool: pse-pd: Fix possible null-deref
Fix a possible null dereference when a PSE supports both c33 and PoDL, but
only one of the netlink attributes is specified. The c33 or PoDL PSE
capabilities are already validated in the ethnl_set_pse_validate() call.
Signed-off-by: Kory Maincent <kory.maincent@...tlin.com>
Reported-by: Jakub Kicinski <kuba@...nel.org>
Closes: https://lore.kernel.org/netdev/20240705184116.13d8235a@kernel.org/
Fixes: 4d18e3ddf427 ("net: ethtool: pse-pd: Expand pse commands with the PSE PoE interface")
---
net/ethtool/pse-pd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ethtool/pse-pd.c b/net/ethtool/pse-pd.c
index 982995ff1628..776ac96cdadc 100644
--- a/net/ethtool/pse-pd.c
+++ b/net/ethtool/pse-pd.c
@@ -178,9 +178,9 @@ ethnl_set_pse(struct ethnl_req_info *req_info, struct genl_info *info)
phydev = dev->phydev;
/* These values are already validated by the ethnl_pse_set_policy */
- if (pse_has_podl(phydev->psec))
+ if (tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL])
config.podl_admin_control = nla_get_u32(tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL]);
- if (pse_has_c33(phydev->psec))
+ if (tb[ETHTOOL_A_C33_PSE_ADMIN_CONTROL])
config.c33_admin_control = nla_get_u32(tb[ETHTOOL_A_C33_PSE_ADMIN_CONTROL]);
/* Return errno directly - PSE has no notification
--
2.34.1
Powered by blists - more mailing lists