]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.10.34/acpi-resources-ignore-invalid-acpi-device-resources.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.10.34 / acpi-resources-ignore-invalid-acpi-device-resources.patch
1 From b355cee88e3b1a193f0e9a81db810f6f83ad728b Mon Sep 17 00:00:00 2001
2 From: Zhang Rui <rui.zhang@intel.com>
3 Date: Thu, 27 Feb 2014 11:37:15 +0800
4 Subject: ACPI / resources: ignore invalid ACPI device resources
5
6 From: Zhang Rui <rui.zhang@intel.com>
7
8 commit b355cee88e3b1a193f0e9a81db810f6f83ad728b upstream.
9
10 ACPI table may export resource entry with 0 length.
11 But the current code interprets this kind of resource in a wrong way.
12 It will create a resource structure with
13 res->end = acpi_resource->start + acpi_resource->len - 1;
14
15 This patch fixes a problem on my machine that a platform device fails
16 to be created because one of its ACPI IO resource entry (start = 0,
17 end = 0, length = 0) is translated into a generic resource with
18 start = 0, end = 0xffffffff.
19
20 Signed-off-by: Zhang Rui <rui.zhang@intel.com>
21 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24 ---
25 drivers/acpi/resource.c | 10 ++++++++++
26 1 file changed, 10 insertions(+)
27
28 --- a/drivers/acpi/resource.c
29 +++ b/drivers/acpi/resource.c
30 @@ -77,18 +77,24 @@ bool acpi_dev_resource_memory(struct acp
31 switch (ares->type) {
32 case ACPI_RESOURCE_TYPE_MEMORY24:
33 memory24 = &ares->data.memory24;
34 + if (!memory24->address_length)
35 + return false;
36 acpi_dev_get_memresource(res, memory24->minimum,
37 memory24->address_length,
38 memory24->write_protect);
39 break;
40 case ACPI_RESOURCE_TYPE_MEMORY32:
41 memory32 = &ares->data.memory32;
42 + if (!memory32->address_length)
43 + return false;
44 acpi_dev_get_memresource(res, memory32->minimum,
45 memory32->address_length,
46 memory32->write_protect);
47 break;
48 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
49 fixed_memory32 = &ares->data.fixed_memory32;
50 + if (!fixed_memory32->address_length)
51 + return false;
52 acpi_dev_get_memresource(res, fixed_memory32->address,
53 fixed_memory32->address_length,
54 fixed_memory32->write_protect);
55 @@ -144,12 +150,16 @@ bool acpi_dev_resource_io(struct acpi_re
56 switch (ares->type) {
57 case ACPI_RESOURCE_TYPE_IO:
58 io = &ares->data.io;
59 + if (!io->address_length)
60 + return false;
61 acpi_dev_get_ioresource(res, io->minimum,
62 io->address_length,
63 io->io_decode);
64 break;
65 case ACPI_RESOURCE_TYPE_FIXED_IO:
66 fixed_io = &ares->data.fixed_io;
67 + if (!fixed_io->address_length)
68 + return false;
69 acpi_dev_get_ioresource(res, fixed_io->address,
70 fixed_io->address_length,
71 ACPI_DECODE_10);