linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerry Snitselaar <jsnitsel@redhat.com>
To: iommu@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Joerg Roedel <joro@8bytes.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH] iommu: amd: call free_iova_fast with pfn in map_sg
Date: Sat, 19 Jan 2019 10:36:11 -0700	[thread overview]
Message-ID: <20190119173611.reqzqxwgf2z22gby@cantor> (raw)
In-Reply-To: <20190117192902.15158-1-jsnitsel@redhat.com>

On Thu Jan 17 19, Jerry Snitselaar wrote:
>In the error path of map_sg, free_iova_fast is being called with
>address instead of the pfn. This results in a bad value getting into
>the rcache, and can result in hitting a BUG_ON when
>iova_magazine_free_pfns is called.
>
>Cc: Joerg Roedel <joro@8bytes.org>
>Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
>Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
>---
> drivers/iommu/amd_iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
>index 87ba23a75b38..418df8ff3e50 100644
>--- a/drivers/iommu/amd_iommu.c
>+++ b/drivers/iommu/amd_iommu.c
>@@ -2623,7 +2623,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
> 	}
>
> out_free_iova:
>-	free_iova_fast(&dma_dom->iovad, address, npages);
>+	free_iova_fast(&dma_dom->iovad, address >> PAGE_SHIFT, npages);
>
> out_err:
> 	return 0;
>-- 
>2.20.1.98.gecbdaf0899
>


I forgot to add the Fixes line.

Fixes: 80187fd39dcb ("iommu/amd: Optimize map_sg and unmap_sg")

  reply	other threads:[~2019-01-19 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 19:29 [PATCH] iommu: amd: call free_iova_fast with pfn in map_sg Jerry Snitselaar
2019-01-19 17:36 ` Jerry Snitselaar [this message]
2019-01-22 10:57 ` Joerg Roedel

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=20190119173611.reqzqxwgf2z22gby@cantor \
    --to=jsnitsel@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suravee.suthikulpanit@amd.com \
    /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).