]> www.infradead.org Git - nvme.git/commit
nvme/host: Fix RCU list traversal to use SRCU primitive nvme-6.12-2024-11-07
authorBreno Leitao <leitao@debian.org>
Mon, 4 Nov 2024 12:24:40 +0000 (04:24 -0800)
committerKeith Busch <kbusch@kernel.org>
Mon, 4 Nov 2024 21:25:41 +0000 (13:25 -0800)
commit6d1c69945ce63a9fba22a4abf646cf960d878782
treeb7f5f421d77b70ed58d9674244c79a8124268c52
parentd0c6cc6c6a6164a853e86206309b5a5bc5e3e72b
nvme/host: Fix RCU list traversal to use SRCU primitive

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/core.c:3770 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.

Fixes: be647e2c76b2 ("nvme: use srcu for iterating namespace list")
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/core.c