From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0B631E98EF; Sun, 7 Jun 2026 10:12:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780827180; cv=none; b=WerJ6FhuwrCEYuBCmqDY/n++54pWniQk3+vDV92PholFquYLKErJrZ/HQAYe8jlczc2+dzUYByhr5Yd/VNVUiBJ0uNmQiq3eOgSWc3AY7h85I2lmLI6up+Tupc0a/WXew3KOE5XNugH1uH4tsRnzfaBvBrOEvnm+h49x8SqJ/TQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780827180; c=relaxed/simple; bh=5IQEwN29R4JkRiroXmXnJaq/P9e6a7+iAs/Hba2U6U8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oZ9fIZyEe5YomqbcRZFnbL1OHPA23tzzIPrWEt0WXxhxcOR+0q74FpmlbC/dM+GJN4Jt6tCHAxWsqqMkM0lM6NPvT9JUPidCvdGmGeIXkhn3v4E9lzkavuAVhFFTOoeJ6OecjruHtlDHXgHzoXzh01aSGK2YT6EmIfD92GSVZgE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2GltOrIR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="2GltOrIR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 313361F00893; Sun, 7 Jun 2026 10:12:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780827179; bh=jQ+5baVZGAPYh1yCKFKHw0ZCvWNNTD/SJ+YNeuOnoOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2GltOrIRlUsPwj7Jis21nrZaYKw2OzaMWhFPxRZMfdM1btywk81EaTPC+yecIBN0m cdBGTsddpbXymQkaW9GK4wyDmpDS4Z9a+9Hg8IEOHSjqiibtzgBKcN3kuuzK2LZGiE 8s4F3rQIgL6FvIOWWrLlz/eQ942AaVoHc/L2wXLw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Maxime Chevallier , Danielle Ratson , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 047/315] ethtool: module: check fw_flash_in_progress under rtnl_lock Date: Sun, 7 Jun 2026 11:57:14 +0200 Message-ID: <20260607095729.310384669@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095727.528828913@linuxfoundation.org> References: <20260607095727.528828913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jakub Kicinski [ Upstream commit 504eaefa44c8dec50f7499edcb36d24f3aefab2a ] 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") Reviewed-by: Maxime Chevallier Reviewed-by: Danielle Ratson Link: https://patch.msgid.link/20260522231312.1710836-5-kuba@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- 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 8929b7fb2fa79c..202e4c25280a76 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) -- 2.53.0