Skip to content

Commit 4cddb0f

Browse files
kmaincentkuba-moo
authored andcommitted
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 <[email protected]> Reported-by: Jakub Kicinski <[email protected]> Closes: https://lore.kernel.org/netdev/[email protected]/ Fixes: 4d18e3d ("net: ethtool: pse-pd: Expand pse commands with the PSE PoE interface") Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 93c3a96 commit 4cddb0f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ethtool/pse-pd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ ethnl_set_pse(struct ethnl_req_info *req_info, struct genl_info *info)
178178

179179
phydev = dev->phydev;
180180
/* These values are already validated by the ethnl_pse_set_policy */
181-
if (pse_has_podl(phydev->psec))
181+
if (tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL])
182182
config.podl_admin_control = nla_get_u32(tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL]);
183-
if (pse_has_c33(phydev->psec))
183+
if (tb[ETHTOOL_A_C33_PSE_ADMIN_CONTROL])
184184
config.c33_admin_control = nla_get_u32(tb[ETHTOOL_A_C33_PSE_ADMIN_CONTROL]);
185185

186186
/* Return errno directly - PSE has no notification

0 commit comments

Comments
 (0)