From: Ewan Milne <emilne@redhat.com>
To: Keith Busch <kbusch@kernel.org>
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: Thu, 6 Nov 2025 14:33:30 -0500 [thread overview]
Message-ID: <CAGtn9rnuRFjA8H79Mn2Q4mRBXJOv7GPpYLYHm-mmDqubPQ-s6Q@mail.gmail.com> (raw)
In-Reply-To: <aQvRDndEfTf3LMab@kbusch-mbp>
On Wed, Nov 5, 2025 at 5:35 PM Keith Busch <kbusch@kernel.org> wrote:
>
> 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.
>
OK, thanks. I think it wise to include Chaitanya's null pointer check also.
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
prev parent reply other threads:[~2025-11-06 19:33 UTC|newest]
Thread overview: 12+ 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
2025-11-06 19:33 ` Ewan Milne [this message]
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=CAGtn9rnuRFjA8H79Mn2Q4mRBXJOv7GPpYLYHm-mmDqubPQ-s6Q@mail.gmail.com \
--to=emilne@redhat.com \
--cc=cachen@purestorage.com \
--cc=chaitanyak@nvidia.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).