linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Matthew Rosato <mjrosato@linux.ibm.com>,
	Pierre Morel <pmorel@linux.ibm.com>,
	iommu@lists.linux.dev
Cc: linux-s390@vger.kernel.org, borntraeger@linux.ibm.com,
	hca@linux.ibm.com, gor@linux.ibm.com,
	gerald.schaefer@linux.ibm.com, agordeev@linux.ibm.com,
	svens@linux.ibm.com, joro@8bytes.org, will@kernel.org,
	robin.murphy@arm.com, jgg@nvidia.com,
	linux-kernel@vger.kernel.org
Subject: [PATCH v5 4/6] iommu/s390: Fix incorrect aperture check
Date: Thu,  6 Oct 2022 16:46:58 +0200	[thread overview]
Message-ID: <20221006144700.3380098-5-schnelle@linux.ibm.com> (raw)
In-Reply-To: <20221006144700.3380098-1-schnelle@linux.ibm.com>

The domain->geometry.aperture_end specifies the last valid address treat
it as such when checking if a DMA address is valid.

Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/iommu/s390-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
index 1f6c9bee9a80..a89fd0256f99 100644
--- a/drivers/iommu/s390-iommu.c
+++ b/drivers/iommu/s390-iommu.c
@@ -206,7 +206,7 @@ static int s390_iommu_update_trans(struct s390_domain *s390_domain,
 	int rc = 0;
 
 	if (dma_addr < s390_domain->domain.geometry.aperture_start ||
-	    dma_addr + size > s390_domain->domain.geometry.aperture_end)
+	    (dma_addr + size - 1) > s390_domain->domain.geometry.aperture_end)
 		return -EINVAL;
 
 	nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
-- 
2.34.1


  parent reply	other threads:[~2022-10-06 14:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 14:46 [PATCH v5 0/6] iommu/s390: Fixes related to attach and aperture handling Niklas Schnelle
2022-10-06 14:46 ` [PATCH v5 1/6] iommu/s390: Fix duplicate domain attachments Niklas Schnelle
2022-10-06 21:02   ` Matthew Rosato
2022-10-07  6:55     ` Niklas Schnelle
2022-10-07 11:20       ` Niklas Schnelle
2022-10-06 14:46 ` [PATCH v5 2/6] iommu/s390: Get rid of s390_domain_device Niklas Schnelle
2022-10-06 15:19   ` Niklas Schnelle
2022-10-06 14:46 ` [PATCH v5 3/6] iommu/s390: Fix potential s390_domain aperture shrinking Niklas Schnelle
2022-10-06 15:21   ` Niklas Schnelle
2022-10-06 21:02   ` Matthew Rosato
2022-10-07  7:37     ` Niklas Schnelle
2022-10-06 14:46 ` Niklas Schnelle [this message]
2022-10-06 14:46 ` [PATCH v5 5/6] iommu/s390: Fix incorrect pgsize_bitmap Niklas Schnelle
2022-10-06 14:47 ` [PATCH v5 6/6] iommu/s390: Implement map_pages()/unmap_pages() instead of map()/unmap() Niklas Schnelle
2022-10-06 21:03   ` Matthew Rosato
2022-10-07  6:59     ` Niklas Schnelle

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=20221006144700.3380098-5-schnelle@linux.ibm.com \
    --to=schnelle@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=pmorel@linux.ibm.com \
    --cc=robin.murphy@arm.com \
    --cc=svens@linux.ibm.com \
    --cc=will@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;
as well as URLs for NNTP newsgroup(s).