diff options
author | Jakub Kicinski <[email protected]> | 2024-07-14 07:16:21 -0700 |
---|---|---|
committer | Jakub Kicinski <[email protected]> | 2024-07-14 07:16:21 -0700 |
commit | 5f25f553b823d8d047662de8cc186f272bfd7fee (patch) | |
tree | af0f2c5ccbe2c5e5dde3a9b4479939079c95f3d0 | |
parent | 70c676cb3dfcc75e32eaf0e98eba6814ebfc6af6 (diff) | |
parent | 4cddb0f15ea9c62f81b4889ea69a99368cc63a86 (diff) |
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]>
-rw-r--r-- | drivers/net/pse-pd/pse_core.c | 4 | ||||
-rw-r--r-- | net/ethtool/pse-pd.c | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/pse-pd/pse_core.c b/drivers/net/pse-pd/pse_core.c index 795ab264eaf2..513cd7f85933 100644 --- a/drivers/net/pse-pd/pse_core.c +++ b/drivers/net/pse-pd/pse_core.c @@ -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; diff --git a/net/ethtool/pse-pd.c b/net/ethtool/pse-pd.c index 2c981d443f27..776ac96cdadc 100644 --- a/net/ethtool/pse-pd.c +++ b/net/ethtool/pse-pd.c @@ -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); } |