Re: [PATCH] nvme: add missing SRCU grace period in error path
From: Keith Busch
Date: Mon Aug 24 2026 - 20:54:15 EST
On Sat, Aug 15, 2026 at 12:14:27AM +0000, Tristan Madani wrote:
> From: Tristan Madani <tristan@xxxxxxxxxxxxxxxxxxx>
>
> nvme_alloc_ns() error path at out_unlink_ns removes ns from the
> namespace head siblings list with list_del_rcu(&ns->siblings) but
> does not wait for SRCU readers before freeing the namespace struct.
> Multipath code iterates the head->list under srcu_read_lock() in
> nvme_find_path() and nvme_mpath_revalidate_paths(), so a concurrent
> reader can still hold a reference to ns when kfree(ns) runs.
>
> The normal removal path in nvme_ns_remove() correctly calls
> synchronize_srcu(&ns->head->srcu) after list_del_rcu() to wait for
> in-progress readers. Add the same grace period in the error path.
Thanks, applied to nvme-7.3.