]> git.ipfire.org Git - thirdparty/linux.git/commit
ethtool: module: avoid racy updates to dev->ethtool bitfield
authorJakub Kicinski <kuba@kernel.org>
Fri, 22 May 2026 23:13:06 +0000 (16:13 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 26 May 2026 15:19:32 +0000 (08:19 -0700)
commit7a84b965ffc12030af63cd10a8f3a1123ff39b7a
tree2fa36ace96cb08b92633c6e826c7f5a5440a0471
parentfb7f511d62692661846c47f199e0afe25c2982db
ethtool: module: avoid racy updates to dev->ethtool bitfield

When reviewing other changes Gemini points out that we currently
update module_fw_flash_in_progress without holding any locks.
Since module_fw_flash_in_progress is part of a bitfield this
is not great, updates to other fields may be lost.

We could use a bool and sprinkle some READ_ONCE/WRITE_ONCE here
but seems like the issue is rather than the work is an unusual
writer. The other writers already hold the right locks. So just
very briefly take these locks when the work completes.

Note that nothing ever cancels the FW update work, so there's
no concern with deadlocks vs cancel.

Fixes: 32b4c8b53ee7 ("ethtool: Add ability to flash transceiver modules' firmware")
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Link: https://patch.msgid.link/20260522231312.1710836-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/module.c