From: Sagi Grimberg <sagig@dev.mellanox.co.il>
To: Christoph Hellwig <hch@lst.de>, axboe@fb.com
Cc: jay.e.sternberg@intel.com, linux-nvme@lists.infradead.org,
keith.busch@intel.com, phil.cayton@intel.com,
stable@vger.kernel.org, james_p_freyensee@linux.intel.com,
mlin@kernel.org
Subject: Re: [PATCH 01/18] nvme: add missing unmaps in nvme_queue_rq
Date: Tue, 20 Oct 2015 13:04:24 +0300 [thread overview]
Message-ID: <562611A8.1060804@dev.mellanox.co.il> (raw)
In-Reply-To: <1444975128-8768-2-git-send-email-hch@lst.de>
On 10/16/2015 8:58 AM, Christoph Hellwig wrote:
> When we fail various metadata related operations in nvme_queue_rq we
> need to unmap the data SGL.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/nvme/host/pci.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 22d8375..2f05292 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -906,19 +906,28 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
> goto retry_cmd;
> }
> if (blk_integrity_rq(req)) {
> - if (blk_rq_count_integrity_sg(req->q, req->bio) != 1)
> + if (blk_rq_count_integrity_sg(req->q, req->bio) != 1) {
> + dma_unmap_sg(dev->dev, iod->sg, iod->nents,
> + dma_dir);
> goto error_cmd;
> + }
>
> sg_init_table(iod->meta_sg, 1);
> if (blk_rq_map_integrity_sg(
> - req->q, req->bio, iod->meta_sg) != 1)
> + req->q, req->bio, iod->meta_sg) != 1) {
> + dma_unmap_sg(dev->dev, iod->sg, iod->nents,
> + dma_dir);
> goto error_cmd;
> + }
This is not related to the patch itself. But this condition seems bogus
to me. We passed meta_sg that consists of a single entry. If we
happened to map more than a single entry we're already in trouble as we
overrun meta_sg (modified the iod->sg pointer).
I think a WARN_ON_ONCE statement is more suitable here (which should
probably come as a separate patch).
Other than that, looks good to me:
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
next prev parent reply other threads:[~2015-10-20 10:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1444975128-8768-1-git-send-email-hch@lst.de>
2015-10-16 5:58 ` [PATCH 01/18] nvme: add missing unmaps in nvme_queue_rq Christoph Hellwig
2015-10-20 10:04 ` Sagi Grimberg [this message]
2015-10-20 14:07 ` Busch, Keith
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=562611A8.1060804@dev.mellanox.co.il \
--to=sagig@dev.mellanox.co.il \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=james_p_freyensee@linux.intel.com \
--cc=jay.e.sternberg@intel.com \
--cc=keith.busch@intel.com \
--cc=linux-nvme@lists.infradead.org \
--cc=mlin@kernel.org \
--cc=phil.cayton@intel.com \
--cc=stable@vger.kernel.org \
/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