[PATCH V2] nvme: move stopping keep-alive into nvme_uninit_ctrl()

Hannes Reinecke hare at suse.de
Mon Aug 12 23:16:12 PDT 2024


On 8/13/24 03:35, Ming Lei wrote:
> Commit 4733b65d82bd ("nvme: start keep-alive after admin queue setup")
> moves starting keep-alive from nvme_start_ctrl() into
> nvme_init_ctrl_finish(), but don't move stopping keep-alive into
> nvme_uninit_ctrl(), so keep-alive work can be started and keep pending
> after failing to start controller, finally use-after-free is triggered if
> nvme host driver is unloaded.
> 
> This patch fixes kernel panic when running nvme/004 in case that connection
> failure is triggered, by moving stopping keep-alive into nvme_uninit_ctrl().
> 
> This way is reasonable because keep-alive is now started in
> nvme_init_ctrl_finish().
> 
> Fixes: 3af755a46881 ("nvme: move nvme_stop_keep_alive() back to original position")
> Cc: Hannes Reinecke <hare at suse.de>
> Cc: Mark O'Donovan <shiftee at posteo.net>
> Reported-by: Changhui Zhong <czhong at redhat.com>
> Reviewed-by: Christoph Hellwig <hch at lst.de>
> Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
> Signed-off-by: Ming Lei <ming.lei at redhat.com>
> ---
> V2:
> 	- fix "Fixes" tag
> 
>   drivers/nvme/host/core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
Reviewed-by: Hannes Reinecke <hare at suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare at suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich




More information about the Linux-nvme mailing list