Skip to content

Commit 5f25f55

Browse files
committed
Merge branch 'net-pse-pd-fix-possible-issues-with-a-pse-supporting-both-c33-and-podl'
Kory Maincent says: ==================== net: pse-pd: Fix possible issues with a PSE supporting both c33 and PoDL Although PSE controllers supporting both c33 and PoDL are not on the market yet, we want to prevent potential issues from arising in the future. Two possible issues could occur with a PSE supporting both c33 and PoDL: - Setting the config for one type of PSE leaves the other type's config null. In this case, the PSE core would return EOPNOTSUPP, which is not the correct behavior. - Null dereference of Netlink attributes as only one of the Netlink attributes would be specified at a time. This patch series contains two patches to fix these issues. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 70c676c + 4cddb0f commit 5f25f55

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

drivers/net/pse-pd/pse_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,13 +719,13 @@ int pse_ethtool_set_config(struct pse_control *psec,
719719
{
720720
int err = 0;
721721

722-
if (pse_has_c33(psec)) {
722+
if (pse_has_c33(psec) && config->c33_admin_control) {
723723
err = pse_ethtool_c33_set_config(psec, config);
724724
if (err)
725725
return err;
726726
}
727727

728-
if (pse_has_podl(psec))
728+
if (pse_has_podl(psec) && config->podl_admin_control)
729729
err = pse_ethtool_podl_set_config(psec, config);
730730

731731
return err;

net/ethtool/pse-pd.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,14 @@ 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

186-
/* Return errno directly - PSE has no notification */
186+
/* Return errno directly - PSE has no notification
187+
* pse_ethtool_set_config() will do nothing if the config is null
188+
*/
187189
return pse_ethtool_set_config(phydev->psec, info->extack, &config);
188190
}
189191

0 commit comments

Comments
 (0)