dell-wmi, hp-wmi, msi-wmi: check wmi_get_event_data() return value
authorLen Brown <len.brown@intel.com>
Sat, 30 Jan 2010 23:01:42 +0000 (18:01 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 23 Feb 2010 15:37:54 +0000 (07:37 -0800)
commit fda11e61ff8a4e3a8ebbd434e46560b67cc0ca9d upstream

[ backport to 2.6.32 ]

When acpi_evaluate_object() is passed ACPI_ALLOCATE_BUFFER,
the caller must kfree the returned buffer if AE_OK is returned.

The callers of wmi_get_event_data() pass ACPI_ALLOCATE_BUFFER,
and thus must check its return value before accessing
or kfree() on the buffer.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/platform/x86/dell-wmi.c
drivers/platform/x86/hp-wmi.c

index f235a9835330d2ae1f8c9f70df9f3f57f023cb44..6dec7cc7475f22c637064649362f3f881a2f3023 100644 (file)
@@ -158,8 +158,13 @@ static void dell_wmi_notify(u32 value, void *context)
        struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
        static struct key_entry *key;
        union acpi_object *obj;
+       acpi_status status;
 
-       wmi_get_event_data(value, &response);
+       status = wmi_get_event_data(value, &response);
+       if (status != AE_OK) {
+               printk(KERN_INFO "dell-wmi: bad event status 0x%x\n", status);
+               return;
+       }
 
        obj = (union acpi_object *)response.pointer;
 
index 36109e19f3498daa00adb2d56d5e9dfa8cd4880e..deb53b55a41fe64c9e8c69eaea0f729c357b0292 100644 (file)
@@ -334,8 +334,13 @@ static void hp_wmi_notify(u32 value, void *context)
        struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
        static struct key_entry *key;
        union acpi_object *obj;
+       acpi_status status;
 
-       wmi_get_event_data(value, &response);
+       status = wmi_get_event_data(value, &response);
+       if (status != AE_OK) {
+               printk(KERN_INFO "hp-wmi: bad event status 0x%x\n", status);
+               return;
+       }
 
        obj = (union acpi_object *)response.pointer;