LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "jianchao.wang" <jianchao.w.wang@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: keith.busch@intel.com, axboe@fb.com, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvme-rdma: fix double free in nvme_rdma_free_queue
Date: Tue, 8 May 2018 16:31:54 +0800	[thread overview]
Message-ID: <65152af5-9dc1-d6fb-6790-6055535f8048@oracle.com> (raw)
In-Reply-To: <20180507122736.GC27843@lst.de>

Hi Christoph

On 05/07/2018 08:27 PM, Christoph Hellwig wrote:
> On Fri, May 04, 2018 at 04:02:18PM +0800, Jianchao Wang wrote:
>> BUG: KASAN: double-free or invalid-free in nvme_rdma_free_queue+0xf6/0x110 [nvme_rdma]
>> Workqueue: nvme-reset-wq nvme_rdma_reset_ctrl_work [nvme_rdma]
>> Call Trace:
>>  dump_stack+0x91/0xeb
>>  print_address_description+0x6b/0x290
>>  kasan_report_invalid_free+0x55/0x80
>>  __kasan_slab_free+0x176/0x190
>>  kfree+0xeb/0x310
>>  nvme_rdma_free_queue+0xf6/0x110 [nvme_rdma]
>>  nvme_rdma_configure_admin_queue+0x1a3/0x4d0 [nvme_rdma]
>>  nvme_rdma_reset_ctrl_work+0x4e/0xd0 [nvme_rdma]
>>  process_one_work+0x3ca/0xaa0
>>  worker_thread+0x4e2/0x6c0
>>  kthread+0x18d/0x1e0
>>  ret_from_fork+0x24/0x30
>>
>> The double free is on ctrl->async_event_sqe.
>> If nvme_rdma_start_queue in nvme_rdma_configure_admin_queue fails,
>> nvme_rdma_free_queue will be invoked. However, at the moment, the
>> ctrl->async_event_sqe has not been allocated and it has been freed
>> in
>> nvme_rdma_reset_ctrl_work
>>   -> nvme_rdma_shutdown_ctrl
>>     ->nvme_rdma_destroy_admin_queue
>>       -> nvme_rdma_free_queue
>>
>> Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
> 
> Can you handle this in the caller instead, maybe including a comment?
> 
Yes, that will be clearer.
Thanks for your suggestion.

Jianchao

      reply	other threads:[~2018-05-08  8:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04  8:02 Jianchao Wang
2018-05-04  9:18 ` Johannes Thumshirn
2018-05-07 12:27 ` Christoph Hellwig
2018-05-08  8:31   ` jianchao.wang [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=65152af5-9dc1-d6fb-6790-6055535f8048@oracle.com \
    --to=jianchao.w.wang@oracle.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --subject='Re: [PATCH] nvme-rdma: fix double free in nvme_rdma_free_queue' \
    /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

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