Thread (27 messages) 27 messages, 4 authors, 11d ago

Re: [PATCH net 4/9] ethtool: module: check fw_flash_in_progress under rtnl_lock

From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: 2026-05-23 14:40:40

Hi,

On 5/23/26 01:13, Jakub Kicinski wrote:
ethnl_set_module_validate() inspects module_fw_flash_in_progress
but validate is meant for _input_ validation, not state validation.
rtnl_lock is not held, yet. Move the check into ethnl_set_module().

Fixes: 32b4c8b53ee7 ("ethtool: Add ability to flash transceiver modules' firmware")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime
quoted hunk ↗ jump to hunk
---
CC: andrew@lunn.ch
CC: petrm@nvidia.com
CC: danieller@nvidia.com
---
  net/ethtool/module.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/ethtool/module.c b/net/ethtool/module.c
index cdb85e19a23b..5b49004ddf60 100644
--- a/net/ethtool/module.c
+++ b/net/ethtool/module.c
@@ -120,12 +120,6 @@ ethnl_set_module_validate(struct ethnl_req_info *req_info,
  	if (!tb[ETHTOOL_A_MODULE_POWER_MODE_POLICY])
  		return 0;
  
-	if (req_info->dev->ethtool->module_fw_flash_in_progress) {
-		NL_SET_ERR_MSG(info->extack,
-			       "Module firmware flashing is in progress");
-		return -EBUSY;
-	}
-
  	if (!ops->get_module_power_mode || !ops->set_module_power_mode) {
  		NL_SET_ERR_MSG_ATTR(info->extack,
  				    tb[ETHTOOL_A_MODULE_POWER_MODE_POLICY],
@@ -148,6 +142,12 @@ ethnl_set_module(struct ethnl_req_info *req_info, struct genl_info *info)
  
  	ops = dev->ethtool_ops;
  
+	if (dev->ethtool->module_fw_flash_in_progress) {
+		NL_SET_ERR_MSG(info->extack,
+			       "Module firmware flashing is in progress");
+		return -EBUSY;
+	}
+
  	power_new.policy = nla_get_u8(tb[ETHTOOL_A_MODULE_POWER_MODE_POLICY]);
  	ret = ops->get_module_power_mode(dev, &power, info->extack);
  	if (ret < 0)
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help