summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resource.c
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2015-02-02 03:42:57 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-02-03 22:27:21 +0100
commita274019fc332d7b4dcb85735978c2018522be312 (patch)
treed815266abf1b39ccc71a23e70ef8a95f05e79d11 /drivers/acpi/resource.c
parentACPI: Set flag IORESOURCE_UNSET for unassigned resources (diff)
downloadlinux-a274019fc332d7b4dcb85735978c2018522be312.tar.xz
linux-a274019fc332d7b4dcb85735978c2018522be312.zip
ACPI: Enforce stricter checks for address space descriptors
Enforce stricter checks for address space descriptors according to ACPI spec. Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/resource.c')
-rw-r--r--drivers/acpi/resource.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index 5bf73a9f26d9..57891a621b96 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -192,6 +192,15 @@ static bool acpi_decode_space(struct resource *res,
bool wp = addr->info.mem.write_protect;
u64 len = attr->address_length;
+ /*
+ * Filter out invalid descriptor according to ACPI Spec 5.0, section
+ * 6.4.3.5 Address Space Resource Descriptors.
+ */
+ if ((addr->min_address_fixed != addr->max_address_fixed && len) ||
+ (addr->min_address_fixed && addr->max_address_fixed && !len))
+ pr_debug("ACPI: Invalid address space min_addr_fix %d, max_addr_fix %d, len %llx\n",
+ addr->min_address_fixed, addr->max_address_fixed, len);
+
res->start = attr->minimum;
res->end = attr->maximum;