[PATCH V5 7/7] nvme-core: warn on allocating admin tag set with existing queue
Christoph Hellwig
hch at lst.de
Tue May 19 04:56:24 PDT 2026
On Tue, May 19, 2026 at 11:33:28AM +0200, Maurizio Lombardi wrote:
> >> + WARN_ON_ONCE(ctrl->admin_q);
> >>
> >> ctrl->admin_q = blk_mq_alloc_queue(set, NULL, NULL);
> >> if (IS_ERR(ctrl->admin_q)) {
> >
> > Why don't you return an error here?
> > The WARN_ON() now introduces a memory leak (at best); I'd rather
> > not do that here as we can easily recover here.
>
> Ok if I just do the following?
>
> if (WARN_ON_ONCE(ctrl->admin_q))
> blk_put_queue(ctrl->admin_q);
No, please keep it as is. The whole point of the WARN_ON is that
it should catch impossible conditions. Leaking a reference is the
least of our problems when it triggers.
More information about the Linux-nvme
mailing list