Skip to content

Commit

Permalink
Merge branch 'net-pse-pd-fix-possible-issues-with-a-pse-supporting-bo…
Browse files Browse the repository at this point in the history
…th-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/20240711-fix_pse_pd_deref-v3-0-edd78fc4fe42@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Jul 14, 2024
2 parents 70c676c + 4cddb0f commit 5f25f55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions drivers/net/pse-pd/pse_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,13 +719,13 @@ int pse_ethtool_set_config(struct pse_control *psec,
{
int err = 0;

if (pse_has_c33(psec)) {
if (pse_has_c33(psec) && config->c33_admin_control) {
err = pse_ethtool_c33_set_config(psec, config);
if (err)
return err;
}

if (pse_has_podl(psec))
if (pse_has_podl(psec) && config->podl_admin_control)
err = pse_ethtool_podl_set_config(psec, config);

return err;
Expand Down
8 changes: 5 additions & 3 deletions net/ethtool/pse-pd.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,14 @@ 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 */
/* Return errno directly - PSE has no notification
* pse_ethtool_set_config() will do nothing if the config is null
*/
return pse_ethtool_set_config(phydev->psec, info->extack, &config);
}

Expand Down

0 comments on commit 5f25f55

Please sign in to comment.