All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: iommu@lists.linux-foundation.org,
	LKML <linux-kernel@vger.kernel.org>,
	Joerg Roedel <joro@8bytes.org>,
	"Lu Baolu" <baolu.lu@linux.intel.com>,
	David Woodhouse <dwmw2@infradead.org>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	Raj Ashok <ashok.raj@intel.com>, "Yi Liu" <yi.l.liu@intel.com>,
	Eric Auger <eric.auger@redhat.com>,
	"Mehta, Sohil" <sohil.mehta@intel.com>,
	Jacob Pan <jacob.jun.pan@linux.intel.com>
Subject: [PATCH v3 5/8] iommu/vt-d: Fix off-by-one in PASID allocation
Date: Tue, 19 Nov 2019 09:56:29 -0800	[thread overview]
Message-ID: <1574186193-30457-6-git-send-email-jacob.jun.pan@linux.intel.com> (raw)
In-Reply-To: <1574186193-30457-1-git-send-email-jacob.jun.pan@linux.intel.com>

PASID allocator uses IDR which is exclusive for the end of the
allocation range. There is no need to decrement pasid_max.

Fixes: af39507305fb ("iommu/vt-d: Apply global PASID in SVA")
Reported-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel-svm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
index 74df10a39dfc..e90d0b914afe 100644
--- a/drivers/iommu/intel-svm.c
+++ b/drivers/iommu/intel-svm.c
@@ -338,7 +338,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_
 		/* Do not use PASID 0 in caching mode (virtualised IOMMU) */
 		ret = intel_pasid_alloc_id(svm,
 					   !!cap_caching_mode(iommu->cap),
-					   pasid_max - 1, GFP_KERNEL);
+					   pasid_max, GFP_KERNEL);
 		if (ret < 0) {
 			kfree(svm);
 			kfree(sdev);
-- 
2.7.4


  parent reply	other threads:[~2019-11-19 17:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 17:56 [PATCH v3 0/8] VT-d Native Shared virtual memory cleanup and fixes Jacob Pan
2019-11-19 17:56 ` [PATCH v3 1/8] iommu/vt-d: Fix CPU and IOMMU SVM feature matching checks Jacob Pan
2019-11-20 20:59   ` Auger Eric
2019-11-20 20:59     ` Auger Eric
2019-11-19 17:56 ` [PATCH v3 2/8] iommu/vt-d: Match CPU and IOMMU paging mode Jacob Pan
2019-11-20 21:08   ` Auger Eric
2019-11-20 21:08     ` Auger Eric
2019-11-19 17:56 ` [PATCH v3 3/8] iommu/vt-d: Reject SVM bind for failed capability check Jacob Pan
2019-11-20 20:59   ` Auger Eric
2019-11-20 20:59     ` Auger Eric
2019-11-19 17:56 ` [PATCH v3 4/8] iommu/vt-d: Avoid duplicated code for PASID setup Jacob Pan
2019-11-20 21:01   ` Auger Eric
2019-11-20 21:01     ` Auger Eric
2019-11-19 17:56 ` Jacob Pan [this message]
2019-11-20 21:02   ` [PATCH v3 5/8] iommu/vt-d: Fix off-by-one in PASID allocation Auger Eric
2019-11-20 21:02     ` Auger Eric
2019-11-19 17:56 ` [PATCH v3 6/8] iommu/vt-d: Replace Intel specific PASID allocator with IOASID Jacob Pan
2019-11-20 21:06   ` Auger Eric
2019-11-20 21:06     ` Auger Eric
2019-11-20 23:19     ` Jacob Pan
2019-11-20 23:19       ` Jacob Pan
2019-11-19 17:56 ` [PATCH v3 7/8] iommu/vt-d: Avoid sending invalid page response Jacob Pan
2019-11-20 21:07   ` Auger Eric
2019-11-20 21:07     ` Auger Eric
2019-11-19 17:56 ` [PATCH v3 8/8] iommu/vt-d: Misc macro clean up for SVM Jacob Pan

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=1574186193-30457-6-git-send-email-jacob.jun.pan@linux.intel.com \
    --to=jacob.jun.pan@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sohil.mehta@intel.com \
    --cc=yi.l.liu@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.