linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH v2] nvmet-rdma: fix possible bogus dereference under heavy load
Date: Tue, 4 Sep 2018 21:06:53 +0200	[thread overview]
Message-ID: <20180904190653.GA2060@lst.de> (raw)
In-Reply-To: <20180903104707.5776-1-sagi@grimberg.me>

On Mon, Sep 03, 2018@03:47:07AM -0700, Sagi Grimberg wrote:
> -	rsp = list_first_entry(&queue->free_rsps,
> +	rsp = list_first_entry_or_null(&queue->free_rsps,
>  				struct nvmet_rdma_rsp, free_list);
> -	list_del(&rsp->free_list);
> +	if (likely(rsp)) {
> +		list_del(&rsp->free_list);
> +		rsp->allocated = false;

Given that we never set allocated to true for something we got from
the freelist, and the structures were allocated using kcalloc I don't
?ee why we need to set it to false here.

Otherwise this looks fine:

Reviewed-by: Christoph Hellwig <hch at lst.de>

  reply	other threads:[~2018-09-04 19:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-03 10:47 [PATCH v2] nvmet-rdma: fix possible bogus dereference under heavy load Sagi Grimberg
2018-09-04 19:06 ` Christoph Hellwig [this message]
2018-09-05 15:14   ` Sagi Grimberg
2018-09-05 17:16     ` 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=20180904190653.GA2060@lst.de \
    --to=hch@lst.de \
    /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).