]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvme/multipath: Fix RCU list traversal to use SRCU primitive
authorBreno Leitao <leitao@debian.org>
Tue, 5 Nov 2024 14:42:46 +0000 (06:42 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 13:03:05 +0000 (14:03 +0100)
commit4eaa19c6205c370b1c055140b68ff77816d8abf3
treefa7c639032f751715263ce777eb3c108ce3c30d0
parent8f95ffb8f86e79e3d44566b8c5a1a925ea639f8c
nvme/multipath: Fix RCU list traversal to use SRCU primitive

[ Upstream commit 5dd18f09ce7399df6fffe80d1598add46c395ae9 ]

The code currently uses list_for_each_entry_rcu() while holding an SRCU
lock, triggering false positive warnings with CONFIG_PROVE_RCU=y
enabled:

drivers/nvme/host/multipath.c:168 RCU-list traversed in non-reader section!!
drivers/nvme/host/multipath.c:227 RCU-list traversed in non-reader section!!
drivers/nvme/host/multipath.c:260 RCU-list traversed in non-reader section!!

While the list is properly protected by SRCU lock, the code uses the
wrong list traversal primitive. Replace list_for_each_entry_rcu() with
list_for_each_entry_srcu() to correctly indicate SRCU-based protection
and eliminate the false warning.

Signed-off-by: Breno Leitao <leitao@debian.org>
Fixes: be647e2c76b2 ("nvme: use srcu for iterating namespace list")
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/multipath.c