All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maurizio Lombardi <mlombard@redhat.com>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: 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: Wed, 3 Nov 2021 12:03:10 +0100	[thread overview]
Message-ID: <20211103110310.GE4840@raketa> (raw)
In-Reply-To: <20211103104516.GD4840@raketa>

> > 
> > 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.

Maurizio



  reply	other threads:[~2021-11-03 11:03 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 [this message]
2021-11-09  8:13       ` Christoph Hellwig
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=20211103110310.GE4840@raketa \
    --to=mlombard@redhat.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.