[PATCH v2 0/2] nvme: fix removing namespaces under SRCU readers
From: Qiliang Yuan
Date: Wed Nov 04 2026 - 01:31:06 EST
nvme_remove_namespaces() splices the namespace list with
list_splice_init_rcu() and synchronize_rcu(), but the list is read
under SRCU. A reader still on the last namespace can then walk onto the
on-stack list head, which KASAN reports as a stack-out-of-bounds read.
Patch 1 adds list_splice_init_srcu() for lists read under SRCU, and
patch 2 uses it in nvme. Both are needed for the fix.
Signed-off-by: Qiliang Yuan <odys.yuan@xxxxxxxxx>
---
V1 -> V2:
- Add list_splice_init_srcu() instead of open-coding the splice in nvme
- Put it in srcu.h, as rculist.h doesn't include srcu.h
- Update the numbers from a new run, median of 3 runs per boot
v1: https://lore.kernel.org/r/20261103-bug-nvme-remove-ns-srcu-v1-1-e239087d63ac@xxxxxxxxx
---
Qiliang Yuan (2):
srcu: Add list_splice_init_srcu()
nvme: wait for SRCU readers before splicing the namespace list
drivers/nvme/host/core.c | 3 +--
include/linux/srcu.h | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261102-bug-nvme-remove-ns-srcu-93d8a75a9b1b
Best regards,
--
Qiliang Yuan <odys.yuan@xxxxxxxxx>