linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH] nvmet-rdma: Fix use after free
Date: Tue, 16 Aug 2016 16:17:41 +0300	[thread overview]
Message-ID: <75d23c63-8ea7-7d76-2b1e-a641e1907e15@grimberg.me> (raw)
In-Reply-To: <1471353085-6743-1-git-send-email-vincent.stehle@intel.com>

> Avoid dereferencing the queue pointer in nvmet_rdma_release_queue_work()
> after it has been freed by nvmet_rdma_free_queue().
>
> Fixes: d8f7750a08968b10 ("nvmet-rdma: Correctly handle RDMA device hot removal")
> Signed-off-by: Vincent Stehl? <vincent.stehle at intel.com>
> Cc: Sagi Grimberg <sagi at grimberg.me>
> Cc: Christoph Hellwig <hch at lst.de>
> ---
>  drivers/nvme/target/rdma.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
> index b4d6485..5de8d0a 100644
> --- a/drivers/nvme/target/rdma.c
> +++ b/drivers/nvme/target/rdma.c
> @@ -978,10 +978,11 @@ static void nvmet_rdma_release_queue_work(struct work_struct *w)
>  		container_of(w, struct nvmet_rdma_queue, release_work);
>  	struct rdma_cm_id *cm_id = queue->cm_id;
>  	struct nvmet_rdma_device *dev = queue->dev;
> +	enum nvmet_rdma_queue_state state = queue->state;
>
>  	nvmet_rdma_free_queue(queue);
>
> -	if (queue->state != NVMET_RDMA_IN_DEVICE_REMOVAL)
> +	if (state != NVMET_RDMA_IN_DEVICE_REMOVAL)
>  		rdma_destroy_id(cm_id);
>
>  	kref_put(&dev->ref, nvmet_rdma_free_dev);
>

Queued for the next round of rc fixes.

Thanks Vincent!

      reply	other threads:[~2016-08-16 13:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03 13:19 [PATCH v4] nvmet-rdma: Correctly handle RDMA device hot removal Sagi Grimberg
2016-08-04 11:50 ` Christoph Hellwig
2016-08-16 13:11 ` [PATCH] nvmet-rdma: Fix use after free Vincent Stehlé
2016-08-16 13:17   ` Sagi Grimberg [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=75d23c63-8ea7-7d76-2b1e-a641e1907e15@grimberg.me \
    --to=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;
as well as URLs for NNTP newsgroup(s).