From: mark gross <mgross@linux.intel.com>
To: Fenghua Yu <fenghua.yu@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
lkml <linux-kernel@vger.kernel.org>,
torvalds@linux-foundation.org
Subject: Re: [PATCH] More Sanity checks for DMAR
Date: Tue, 20 Nov 2007 10:58:22 -0800 [thread overview]
Message-ID: <20071120185822.GA25785@linux.intel.com> (raw)
In-Reply-To: <20071119230348.GA18775@linux-os.sc.intel.com>
On Mon, Nov 19, 2007 at 03:03:48PM -0800, Fenghua Yu wrote:
>
> This patch adds and changes a few sanity checks in dmar.c.
>
> 1. The haw field in ACPI DMAR table in VT-d spec doesn't describe the range of
> haw. But since DMA page size is 4KB in DMA remapping, haw should be at least
> 4KB. The current VT-d code in dmar.c returns failure when haw==0. This sanity
> check is not accurate and execution can pass when haw is less than one page
> size 4KB. This patch changes the haw sanity check to validate if haw is less
> than 4KB.
> 2. Add dmar_rmrr_units verification.
> 3. Add parse_dmar_table() verification.
>
> Thanks.
>
> -Fenghua
>
> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
>
> ---
>
> dmar.c | 20 +++++++++++++++++---
> 1 files changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
> index 5dfdfda..a5b6ed0 100644
> --- a/drivers/pci/dmar.c
> +++ b/drivers/pci/dmar.c
> @@ -25,6 +25,7 @@
>
> #include <linux/pci.h>
> #include <linux/dmar.h>
> +#include "iova.h"
>
> #undef PREFIX
> #define PREFIX "DMAR:"
> @@ -263,8 +264,8 @@ parse_dmar_table(void)
> if (!dmar)
> return -ENODEV;
>
> - if (!dmar->width) {
> - printk (KERN_WARNING PREFIX "Zero: Invalid DMAR haw\n");
> + if (dmar->width < PAGE_SHIFT_4K - 1) {
> + printk (KERN_WARNING PREFIX "Invalid DMAR haw\n");
> return -EINVAL;
> }
>
> @@ -301,11 +302,24 @@ parse_dmar_table(void)
> int __init dmar_table_init(void)
> {
>
> - parse_dmar_table();
> + int ret;
> +
> + ret = parse_dmar_table();
> + if (ret) {
> + printk(KERN_INFO PREFIX "parse DMAR table failure.\n");
> + return ret;
> + }
> +
> if (list_empty(&dmar_drhd_units)) {
> printk(KERN_INFO PREFIX "No DMAR devices found\n");
> return -ENODEV;
> }
> +
> + if (list_empty(&dmar_rmrr_units)) {
> + printk(KERN_INFO PREFIX "No RMRR found\n");
> + return -ENODEV;
> + }
> +
> return 0;
> }
>
> -
Ack : mark gross <mgross@linux.intel.com>
Thanks,
--mgross
next prev parent reply other threads:[~2007-11-20 19:02 UTC|newest]
Thread overview: 27+ 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 [this message]
[not found] ` <617E1C2C70743745A92448908E030B2A02AD5AD7@scsmsx411.amr.corp.intel.com>
2008-05-02 22:26 ` [PATCH] Handle invalid ACPI SLIT table Fenghua Yu
2008-05-02 22:26 ` Fenghua Yu
2008-05-02 22:26 ` 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-01 16:57 ` Fenghua Yu
2008-10-02 8:29 ` [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel Ingo Molnar
2008-10-02 8:29 ` [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel IOMMU: Generic Part Ingo Molnar
2008-10-02 22:06 ` [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel Yu, Fenghua
2008-10-02 22:06 ` [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel IOMMU: Generic Part Yu, Fenghua
2008-10-03 8:54 ` [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel Ingo Molnar
2008-10-03 8:54 ` [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel IOMMU: Generic Part Ingo Molnar
2008-10-02 15:31 ` Bjorn Helgaas
2008-10-02 15:31 ` Bjorn Helgaas
2008-10-02 21:46 ` [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel Yu, Fenghua
2008-10-02 21:46 ` [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel IOMMU: Generic Part Yu, Fenghua
2008-10-03 15:33 ` Bjorn Helgaas
2008-10-03 15:33 ` Bjorn Helgaas
2008-10-04 0:21 ` [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel Yu, Fenghua
2008-10-04 0:21 ` [PATCH 1/2]Add Variable Page Size and IA64 Support in Intel IOMMU: Generic Part Yu, Fenghua
2008-10-07 0:01 ` [PATCH V2 1/2] Add " Fenghua Yu
2008-10-07 0:01 ` Fenghua Yu
2009-08-04 22:10 ` [PATCH 2/4] Bug Fix drivers/pci/intel-iommu.c: secure sg_next() calling Fenghua Yu
2009-08-04 22:10 ` Fenghua Yu
2009-08-05 8:09 ` [PATCH 2/4] Bug Fix drivers/pci/intel-iommu.c: secure David Woodhouse
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=20071120185822.GA25785@linux.intel.com \
--to=mgross@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=fenghua.yu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.