From: Keith Busch <kbusch@kernel.org>
To: Ewan Milne <emilne@redhat.com>
Cc: Keith Busch <kbusch@meta.com>,
linux-nvme@lists.infradead.org, hch@lst.de, ming.lei@redhat.com,
chaitanyak@nvidia.com, Casey Chen <cachen@purestorage.com>
Subject: Re: [PATCH] nvme: fix admin request_queue lifetime
Date: Wed, 5 Nov 2025 15:34:54 -0700 [thread overview]
Message-ID: <aQvRDndEfTf3LMab@kbusch-mbp> (raw)
In-Reply-To: <CAGtn9rnm-V4Ejm9kRkvV91XAO98XF7jv9Y7Kjr611BbffikkEg@mail.gmail.com>
On Wed, Nov 05, 2025 at 04:31:13PM -0500, Ewan Milne wrote:
> On Tue, Nov 4, 2025 at 6:00 PM Keith Busch <kbusch@meta.com> wrote:
> >
> > From: Keith Busch <kbusch@kernel.org>
> >
> > The namespaces can access the controller's admin request_queue, and
> > stale references on the namespaces may exist. Ensure the request_queue
> > is active by moving the controller's 'put' after all references on the
> > controller have been released to ensure no one is trying to access the
> > request_queue. This fixes a reported use-after-free bug:
> >
>
> OK, so I get that this fixes the use-after-free, and don't let my
> comments hold up
> acceptance of the patch. But can you explain why this actually helps?
> nvme_alloc_admin_tag_set() allocates the admin_q as part of the admin tagset
> initiailization, and doesn't this change keep the lifetime of the
> admin_q past when
> the admin tagset is deallocated? So where do we detect that?
We still call blk_mq_destroy_queue() prior to calling
blk_mq_free_tag_set(). The queue has exited the tagset and set to dying;
no one can "enter" the queue after that, so that tagset can be safely
freed even if people are holding references on that dying queue.
next prev parent reply other threads:[~2025-11-05 22:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 22:59 [PATCH] nvme: fix admin request_queue lifetime Keith Busch
2025-11-04 23:08 ` Chaitanya Kulkarni
2025-11-04 23:22 ` Casey Chen
2025-11-05 1:20 ` Ming Lei
2025-11-05 7:38 ` Hannes Reinecke
2025-11-05 13:14 ` Christoph Hellwig
2025-11-05 20:21 ` Casey Chen
2025-11-05 20:31 ` Keith Busch
2025-11-06 0:10 ` Chaitanya Kulkarni
2025-11-05 21:31 ` Ewan Milne
2025-11-05 22:34 ` Keith Busch [this message]
2025-11-06 19:33 ` Ewan Milne
2025-11-30 23:16 ` Sagi Grimberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aQvRDndEfTf3LMab@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=cachen@purestorage.com \
--cc=chaitanyak@nvidia.com \
--cc=emilne@redhat.com \
--cc=hch@lst.de \
--cc=kbusch@meta.com \
--cc=linux-nvme@lists.infradead.org \
--cc=ming.lei@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox