All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] nvme: fix removing namespaces under SRCU readers
@ 2026-11-04  6:30 Qiliang Yuan
  2026-11-04  6:30 ` [PATCH v2 1/2] srcu: Add list_splice_init_srcu() Qiliang Yuan
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Qiliang Yuan @ 2026-11-04  6:30 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Lai Jiangshan, Paul E. McKenney, Josh Triplett, Onur Özkan,
	Steven Rostedt, Mathieu Desnoyers
  Cc: linux-nvme, linux-kernel, rcu, Qiliang Yuan, stable

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@gmail.com>
---
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@gmail.com

---
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@gmail.com>



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-11-05 18:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04  6:30 [PATCH v2 0/2] nvme: fix removing namespaces under SRCU readers Qiliang Yuan
2026-11-04  6:30 ` [PATCH v2 1/2] srcu: Add list_splice_init_srcu() Qiliang Yuan
2026-11-04 17:14   ` Paul E. McKenney
2026-11-05  1:22     ` Qiliang Yuan
2026-11-05  1:44       ` Paul E. McKenney
2026-11-05  1:25     ` Qiliang Yuan
2026-11-05  1:46     ` Paul E. McKenney
2026-11-05  1:56       ` Qiliang Yuan
2026-11-05  7:45       ` Christoph Hellwig
2026-11-05 18:42         ` Paul E. McKenney
2026-11-05  7:46   ` Christoph Hellwig
2026-11-04  6:30 ` [PATCH v2 2/2] nvme: wait for SRCU readers before splicing the namespace list Qiliang Yuan
2026-11-05  7:46   ` Christoph Hellwig
2026-11-05 15:11 ` [PATCH v2 0/2] nvme: fix removing namespaces under SRCU readers Keith Busch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.