]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.10.34/pnp-acpi-proper-handling-of-acpi-io-memory-resource-parsing-failures.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.10.34 / pnp-acpi-proper-handling-of-acpi-io-memory-resource-parsing-failures.patch
1 From 89935315f192abf7068d0044cefc84f162c3c81f Mon Sep 17 00:00:00 2001
2 From: Zhang Rui <rui.zhang@intel.com>
3 Date: Tue, 11 Mar 2014 22:40:27 +0800
4 Subject: PNP / ACPI: proper handling of ACPI IO/Memory resource parsing failures
5
6 From: Zhang Rui <rui.zhang@intel.com>
7
8 commit 89935315f192abf7068d0044cefc84f162c3c81f upstream.
9
10 Before commit b355cee88e3b (ACPI / resources: ignore invalid ACPI
11 device resources), if acpi_dev_resource_memory()/acpi_dev_resource_io()
12 returns false, it means the the resource is not a memeory/IO resource.
13
14 But after commit b355cee88e3b, those functions return false if the
15 given memory/IO resource entry is invalid (the length of the resource
16 is zero).
17
18 This breaks pnpacpi_allocated_resource(), because it now recognizes
19 the invalid memory/io resources as resources of unknown type. Thus
20 users see confusing warning messages on machines with zero length
21 ACPI memory/IO resources.
22
23 Fix the problem by rearranging pnpacpi_allocated_resource() so that
24 it calls acpi_dev_resource_memory() for memory type and IO type
25 resources only, respectively.
26
27 Fixes: b355cee88e3b (ACPI / resources: ignore invalid ACPI device resources)
28 Signed-off-by: Zhang Rui <rui.zhang@intel.com>
29 Reported-and-tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
30 Reported-and-tested-by: Julian Wollrath <jwollrath@web.de>
31 Reported-and-tested-by: Paul Bolle <pebolle@tiscali.nl>
32 [rjw: Changelog]
33 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
34 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
35
36 ---
37 drivers/pnp/pnpacpi/rsparser.c | 15 ++++++++++++---
38 1 file changed, 12 insertions(+), 3 deletions(-)
39
40 --- a/drivers/pnp/pnpacpi/rsparser.c
41 +++ b/drivers/pnp/pnpacpi/rsparser.c
42 @@ -183,9 +183,7 @@ static acpi_status pnpacpi_allocated_res
43 struct resource r;
44 int i, flags;
45
46 - if (acpi_dev_resource_memory(res, &r)
47 - || acpi_dev_resource_io(res, &r)
48 - || acpi_dev_resource_address_space(res, &r)
49 + if (acpi_dev_resource_address_space(res, &r)
50 || acpi_dev_resource_ext_address_space(res, &r)) {
51 pnp_add_resource(dev, &r);
52 return AE_OK;
53 @@ -217,6 +215,17 @@ static acpi_status pnpacpi_allocated_res
54 }
55
56 switch (res->type) {
57 + case ACPI_RESOURCE_TYPE_MEMORY24:
58 + case ACPI_RESOURCE_TYPE_MEMORY32:
59 + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
60 + if (acpi_dev_resource_memory(res, &r))
61 + pnp_add_resource(dev, &r);
62 + break;
63 + case ACPI_RESOURCE_TYPE_IO:
64 + case ACPI_RESOURCE_TYPE_FIXED_IO:
65 + if (acpi_dev_resource_io(res, &r))
66 + pnp_add_resource(dev, &r);
67 + break;
68 case ACPI_RESOURCE_TYPE_DMA:
69 dma = &res->data.dma;
70 if (dma->channel_count > 0 && dma->channels[0] != (u8) -1)