[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090804221024.GA21406@linux-os.sc.intel.com>
Date: Tue, 4 Aug 2009 15:10:24 -0700
From: Fenghua Yu <fenghua.yu@...el.com>
To: David Woodhouse <dwmw2@...radead.org>,
Tony Luck <tony.luck@...el.com>
Cc: iommu@...ts.linux-foundation.org, linux-ia64@...r.kernel.org,
linux-kernel@...r.kernel.org, Fenghua Yu <fenghua.yu@...el.com>
Subject: [PATCH 2/4] Bug Fix drivers/pci/intel-iommu.c: secure sg_next() calling
sg_next() is called only when sg is not NULL. This solves a kernel panic on
some platforms (e.g. ia64).
Signed-off-by: Fenghua Yu <fenghua.yu@...el.com>
---
drivers/pci/intel-iommu.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index bec29ed..54ee63d 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -1705,8 +1715,12 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
iov_pfn++;
pteval += VTD_PAGE_SIZE;
sg_res--;
- if (!sg_res)
- sg = sg_next(sg);
+ if (!sg_res) {
+ if (sg)
+ sg = sg_next(sg);
+ else
+ return 0;
+ }
}
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists