Re: [PATCH 2/4] Bug Fix drivers/pci/intel-iommu.c: securesg_next() calling

From: David Woodhouse
Date: Wed Aug 05 2009 - 04:10:20 EST


On Tue, 2009-08-04 at 15:10 -0700, Fenghua Yu wrote:
> sg_next() is called only when sg is not NULL. This solves a kernel panic on
> some platforms (e.g. ia64).

Is this still necessary after we fix the other bugs? When does it
happen? And is this fix sufficient (ignore the first hunk; it's just a
cleanup that the fix allows me to make, which is why I'd prefer to do it
this way):

diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 11b317a..c9bdb0b 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -1675,7 +1675,7 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
if (sg)
sg_res = 0;
else {
- sg_res = nr_pages + 1;
+ sg_res = nr_pages;
pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | prot;
}

@@ -1716,7 +1716,7 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
iov_pfn++;
pteval += VTD_PAGE_SIZE;
sg_res--;
- if (!sg_res)
+ if (nr_pages && !sg_res)
sg = sg_next(sg);
}
return 0;


--
David Woodhouse Open Source Technology Centre
David.Woodhouse@xxxxxxxxx Intel Corporation

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/