[PATCH 2/4] nvmet: propagate percpu_ref_init() failure in nvmet_ns_enable()

Nilay Shroff nilay at linux.ibm.com
Thu Jul 30 05:06:38 PDT 2026


On 7/30/26 10:01 AM, Guixin Liu wrote:
> The return value of percpu_ref_init() is discarded. At this point ret is
> 0 from the preceding successful steps, so when the allocation inside
> percpu_ref_init() fails the code jumps to the out_pr_exit cleanup chain
> which ends with "return ret", i.e. reports success. The configfs enable
> store then tells userspace the namespace was enabled even though it was
> not and its backing device has already been torn down.
> 
> Capture the return value so the failure is propagated.
> 
> Fixes: 408232680707 ("nvmet: Fix crash when a namespace is disabled")
> Signed-off-by: Guixin Liu <kanie at linux.alibaba.com>

Looks good to me.

Reviewed-by: Nilay Shroff <nilay at linux.ibm.com>



More information about the Linux-nvme mailing list