]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.32.9/dell-wmi-hp-wmi-msi-wmi-check-wmi_get_event_data-return-value.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.9 / dell-wmi-hp-wmi-msi-wmi-check-wmi_get_event_data-return-value.patch
CommitLineData
739e1c91
GKH
1From cebbert@redhat.com Fri Feb 12 13:29:54 2010
2From: Len Brown <len.brown@intel.com>
3Date: Sat, 30 Jan 2010 18:01:42 -0500
4Subject: dell-wmi, hp-wmi, msi-wmi: check wmi_get_event_data() return value
5To: stable@kernel.org
6Cc: Len Brown <len.brown@intel.com>
7Message-ID: <201002030139.o131dtPR012382@int-mx03.intmail.prod.int.phx2.redhat.com>
8
9
10From: Len Brown <len.brown@intel.com>
11
12commit fda11e61ff8a4e3a8ebbd434e46560b67cc0ca9d upstream
13
14[ backport to 2.6.32 ]
15
16When acpi_evaluate_object() is passed ACPI_ALLOCATE_BUFFER,
17the caller must kfree the returned buffer if AE_OK is returned.
18
19The callers of wmi_get_event_data() pass ACPI_ALLOCATE_BUFFER,
20and thus must check its return value before accessing
21or kfree() on the buffer.
22
23Signed-off-by: Len Brown <len.brown@intel.com>
24Cc: Chuck Ebbert <cebbert@redhat.com>
25Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
26
27---
28 drivers/platform/x86/dell-wmi.c | 7 ++++++-
29 drivers/platform/x86/hp-wmi.c | 7 ++++++-
30 2 files changed, 12 insertions(+), 2 deletions(-)
31
32--- a/drivers/platform/x86/dell-wmi.c
33+++ b/drivers/platform/x86/dell-wmi.c
34@@ -158,8 +158,13 @@ static void dell_wmi_notify(u32 value, v
35 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
36 static struct key_entry *key;
37 union acpi_object *obj;
38+ acpi_status status;
39
40- wmi_get_event_data(value, &response);
41+ status = wmi_get_event_data(value, &response);
42+ if (status != AE_OK) {
43+ printk(KERN_INFO "dell-wmi: bad event status 0x%x\n", status);
44+ return;
45+ }
46
47 obj = (union acpi_object *)response.pointer;
48
49--- a/drivers/platform/x86/hp-wmi.c
50+++ b/drivers/platform/x86/hp-wmi.c
51@@ -334,8 +334,13 @@ static void hp_wmi_notify(u32 value, voi
52 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
53 static struct key_entry *key;
54 union acpi_object *obj;
55+ acpi_status status;
56
57- wmi_get_event_data(value, &response);
58+ status = wmi_get_event_data(value, &response);
59+ if (status != AE_OK) {
60+ printk(KERN_INFO "hp-wmi: bad event status 0x%x\n", status);
61+ return;
62+ }
63
64 obj = (union acpi_object *)response.pointer;
65