From: Fenghua Yu <fenghua.yu@intel.com>
To: David Woodhouse <dwmw2@infradead.org>, Tony Luck <tony.luck@intel.com>
Cc: iommu@lists.linux-foundation.org, linux-ia64@vger.kernel.org,
linux-kernel@vger.kernel.org, Fenghua Yu <fenghua.yu@intel.com>
Subject: [PATCH 2/4] Bug Fix drivers/pci/intel-iommu.c: secure sg_next() calling
Date: Tue, 4 Aug 2009 15:10:24 -0700 [thread overview]
Message-ID: <20090804221024.GA21406@linux-os.sc.intel.com> (raw)
In-Reply-To: <617E1C2C70743745A92448908E030B2A02AD5AD7@scsmsx411.amr.corp.intel.com>
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@intel.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;
}
next prev parent reply other threads:[~2009-08-04 22:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <BAE9DCEF64577A439B3A37F36F9B691C0339372B@orsmsx418.amr.corp.intel.com>
2007-11-19 23:03 ` [PATCH] More Sanity checks for DMAR Fenghua Yu
2007-11-20 18:58 ` mark gross
[not found] ` <617E1C2C70743745A92448908E030B2A02AD5AD7@scsmsx411.amr.corp.intel.com>
2008-05-02 22:26 ` [PATCH] Handle invalid ACPI SLIT table Fenghua Yu
2008-10-01 16:57 ` [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel IOMMU: Generic Part Fenghua Yu
2008-10-02 8:29 ` Ingo Molnar
2008-10-02 22:06 ` Yu, Fenghua
2008-10-03 8:54 ` Ingo Molnar
2008-10-02 15:31 ` Bjorn Helgaas
2008-10-02 21:46 ` Yu, Fenghua
2008-10-03 15:33 ` Bjorn Helgaas
2008-10-04 0:21 ` Yu, Fenghua
2008-10-07 0:01 ` [PATCH V2 1/2] Add " Fenghua Yu
2009-08-04 22:10 ` Fenghua Yu [this message]
2009-08-05 8:09 ` [PATCH 2/4] Bug Fix drivers/pci/intel-iommu.c: secure sg_next() calling David Woodhouse
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=20090804221024.GA21406@linux-os.sc.intel.com \
--to=fenghua.yu@intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox