From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932635AbcFCOwa (ORCPT ); Fri, 3 Jun 2016 10:52:30 -0400 Received: from mail.gondor.com ([78.47.100.206]:59804 "EHLO mail1.gondor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932150AbcFCOw0 (ORCPT ); Fri, 3 Jun 2016 10:52:26 -0400 Date: Fri, 3 Jun 2016 16:52:13 +0200 From: Jan Niehusmann To: linux-kernel@vger.kernel.org, Adam Morrison Cc: Omer Peleg , Shaohua Li , Ben Serebrin , David Woodhouse Subject: [PATCH] iommu/vt-d: fix overflow of iommu->domains array Message-ID: <20160603145213.GA2889@x61s.reliablesolutions.de> References: <20160602102443.GA21132@jannic.reliablesolutions.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160602102443.GA21132@jannic.reliablesolutions.de> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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