]> git.hungrycats.org Git - linux/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 12:54:29 +0000 (13:54 +0100)
commitc03cc062e3acccc6693a6f70d611784c39b9b2d4
tree40b9eb75ef1830f42ffa88d4360241b06500c62b
parent64184804a74e5cab8bb71bc856b4693d5d06cdb0
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