Skip to content

Commit b84bb7b

Browse files
Ming Leikeithbusch
authored andcommitted
nvme: fix admin queue leak on controller reset
When nvme_alloc_admin_tag_set() is called during a controller reset, a previous admin queue may still exist. Release it properly before allocating a new one to avoid orphaning the old queue. This fixes a regression introduced by commit 03b3bcd ("nvme: fix admin request_queue lifetime"). Cc: Keith Busch <kbusch@kernel.org> Fixes: 03b3bcd ("nvme: fix admin request_queue lifetime"). Reported-and-tested-by: Yi Zhang <yi.zhang@redhat.com> Closes: https://lore.kernel.org/linux-block/CAHj4cs9wv3SdPo+N01Fw2SHBYDs9tj2M_e1-GdQOkRy=DsBB1w@mail.gmail.com/ Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 0a1fc2f commit b84bb7b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/nvme/host/core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4860,6 +4860,13 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
48604860
if (ret)
48614861
return ret;
48624862

4863+
/*
4864+
* If a previous admin queue exists (e.g., from before a reset),
4865+
* put it now before allocating a new one to avoid orphaning it.
4866+
*/
4867+
if (ctrl->admin_q)
4868+
blk_put_queue(ctrl->admin_q);
4869+
48634870
ctrl->admin_q = blk_mq_alloc_queue(set, &lim, NULL);
48644871
if (IS_ERR(ctrl->admin_q)) {
48654872
ret = PTR_ERR(ctrl->admin_q);

0 commit comments

Comments
 (0)