public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Maurizio Lombardi <mlombard@redhat.com>
Cc: Sagi Grimberg <sagi@grimberg.me>,
	linux-nvme@lists.infradead.org, kbusch@kernel.org, axboe@fb.com,
	hch@lst.de
Subject: Re: [PATCH] nvme-tcp: fix memory leak when freeing a queue
Date: Tue, 9 Nov 2021 09:13:03 +0100	[thread overview]
Message-ID: <20211109081303.GC28785@lst.de> (raw)
In-Reply-To: <20211103110310.GE4840@raketa>

On Wed, Nov 03, 2021 at 12:03:10PM +0100, Maurizio Lombardi wrote:
> > > 
> > > Thanks Maurizio,
> > > 
> > > Why do we need to the pf_cache.va protection? nvme_tcp_free_queue
> > > is already protected against re-entry with the NVME_TCP_Q_ALLOCATED
> > > bit.
> > > 
> > 
> > It's not the re-entry what worried me, I thought that nvme_tcp_free_queue()
> > might be called before page_frag_alloc() had the chance to initialize the pf_cache, triggering
> > a NULL pointer dereference. I am doing some tests right now and it seems not to be
> > possible so maybe we can drop the "if".
> 
> Oh wait, if nvme_tcp_setup_ctrl() fails it could call nvme_tcp_destroy_io_queues() and
> iI guess that in that case the pf_cache is not initialized, so the if(pf_cache.va) protection
> is necessary.

Sagi, does this look good to you now?


  reply	other threads:[~2021-11-09  8:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03  8:18 [PATCH] nvme-tcp: fix memory leak when freeing a queue Maurizio Lombardi
2021-11-03  9:23 ` Sagi Grimberg
2021-11-03 10:45   ` Maurizio Lombardi
2021-11-03 11:03     ` Maurizio Lombardi
2021-11-09  8:13       ` Christoph Hellwig [this message]
2021-11-09 15:37         ` John Meneghini
2021-11-09 15:54         ` Sagi Grimberg
2021-11-11 10:00 ` Christoph Hellwig

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=20211109081303.GC28785@lst.de \
    --to=hch@lst.de \
    --cc=axboe@fb.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mlombard@redhat.com \
    --cc=sagi@grimberg.me \
    /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