]> Git Repo - linux.git/commitdiff
net: ethtool: pse-pd: Fix possible null-deref
authorKory Maincent <[email protected]>
Thu, 11 Jul 2024 13:55:19 +0000 (15:55 +0200)
committerJakub Kicinski <[email protected]>
Sun, 14 Jul 2024 14:16:18 +0000 (07:16 -0700)
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: 4d18e3ddf427 ("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]>
net/ethtool/pse-pd.c

index 982995ff16280ac89de65a5373127d3a234bba00..776ac96cdadc92fa7f4c430dcbac4f0a969df1b7 100644 (file)
@@ -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
This page took 0.055754 seconds and 4 git commands to generate.