linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Niehusmann <jan@gondor.com>
To: linux-kernel@vger.kernel.org, Adam Morrison <mad@cs.technion.ac.il>
Cc: Omer Peleg <omer@cs.technion.ac.il>, Shaohua Li <shli@fb.com>,
	Ben Serebrin <serebrin@google.com>,
	David Woodhouse <David.Woodhouse@intel.com>
Subject: [PATCH] iommu/vt-d: fix overflow of iommu->domains array
Date: Fri, 3 Jun 2016 16:52:13 +0200	[thread overview]
Message-ID: <20160603145213.GA2889@x61s.reliablesolutions.de> (raw)
In-Reply-To: <20160602102443.GA21132@jannic.reliablesolutions.de>

The valid range of did in get_iommu_domain(*iommu, did)
is 0..cap_ndoms(iommu->cap), so don't exceed that
range in free_all_cpu_cached_iovas().

Signed-off-by: Jan Niehusmann <jan@gondor.com>
---
 drivers/iommu/intel-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index a644d0c..82989d4 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4600,7 +4600,7 @@ static void free_all_cpu_cached_iovas(unsigned int cpu)
 		if (!iommu)
 			continue;
 
-		for (did = 0; did < 0xffff; did++) {
+		for (did = 0; did < cap_ndoms(iommu->cap); did++) {
 			domain = get_iommu_domain(iommu, did);
 
 			if (!domain)
-- 
2.1.4

      reply	other threads:[~2016-06-03 14:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02 10:24 Suspend broken on Thinkpad x201s since 4.7-rc1 Jan Niehusmann
2016-06-03 14:52 ` Jan Niehusmann [this message]

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=20160603145213.GA2889@x61s.reliablesolutions.de \
    --to=jan@gondor.com \
    --cc=David.Woodhouse@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mad@cs.technion.ac.il \
    --cc=omer@cs.technion.ac.il \
    --cc=serebrin@google.com \
    --cc=shli@fb.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).