Re: -tip: origin tree boot crash

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Len Brown
Date: Saturday, December 26, 2009 - 9:20 pm

On Sat, 26 Dec 2009, Len Brown wrote:



These kfree's look correct, assuming we properly check
the return status.  So perhaps instead you can test
the patch below?

thanks,
-Len

From 5caa3ab36da77d59017cff9b9d1e910862b489e7 Mon Sep 17 00:00:00 2001
Message-Id: <5caa3ab36da77d59017cff9b9d1e910862b489e7.1261887124.git.len.brown@intel.com>
In-Reply-To: <51b0f1c2b8c32ee44ff01ef74599a1f17e4fc565.1261887124.git.len.brown@intel.com>
References: <51b0f1c2b8c32ee44ff01ef74599a1f17e4fc565.1261887124.git.len.brown@intel.com>
From: Len Brown <len.brown@intel.com>
Date: Sat, 26 Dec 2009 23:02:24 -0500
Subject: [PATCH 3/3] dell-wmi, hp-wmi, msi-wmi: check wmi_get_event_data() return value
X-Patchwork-Hint: ignore

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>
---
 drivers/platform/x86/dell-wmi.c |    7 ++++++-
 drivers/platform/x86/hp-wmi.c   |    7 ++++++-
 drivers/platform/x86/msi-wmi.c  |    7 ++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 4c7e702..500af8c 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -202,8 +202,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;
 
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 18bf741..5b648f0 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -338,8 +338,13 @@ static void hp_wmi_notify(u32 value, void *context)
 	static struct key_entry *key;
 	union acpi_object *obj;
 	int eventcode;
+	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;
 
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
index f746c67..f5f70d4 100644
--- a/drivers/platform/x86/msi-wmi.c
+++ b/drivers/platform/x86/msi-wmi.c
@@ -149,8 +149,13 @@ static void msi_wmi_notify(u32 value, void *context)
 	static struct key_entry *key;
 	union acpi_object *obj;
 	ktime_t cur;
+	acpi_status status;
 
-	wmi_get_event_data(value, &response);
+	status = wmi_get_event_data(value, &response);
+	if (status != AE_OK) {
+		printk(KERN_INFO DRV_PFX "bad event status 0x%x\n", status);
+		return;
+	}
 
 	obj = (union acpi_object *)response.pointer;
 
-- 
1.6.0.6

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Linux 2.6.33-rc2 - Merry Christmas ..., Linus Torvalds, (Thu Dec 24, 3:00 pm)
-tip: origin tree boot crash, Ingo Molnar, (Fri Dec 25, 3:27 am)
Re: Linux 2.6.33-rc2 - Blank screen for Intel KMS, Miguel Calleja, (Fri Dec 25, 6:10 am)
Re: -tip: origin tree boot crash, Dmitry Torokhov, (Fri Dec 25, 12:49 pm)
Re: Linux 2.6.33-rc2 - Merry Christmas ..., Borislav Petkov, (Fri Dec 25, 1:00 pm)
Re: Linux 2.6.33-rc2 - Merry Christmas ..., Borislav Petkov, (Fri Dec 25, 2:50 pm)
Re: Linux 2.6.33-rc2 - Merry Christmas ..., Jesse Barnes, (Fri Dec 25, 11:00 pm)
Re: Linux 2.6.33-rc2 - Merry Christmas ..., Borislav Petkov, (Sat Dec 26, 1:02 am)
Re: -tip: origin tree boot crash, Len Brown, (Sat Dec 26, 1:17 pm)
Re: -tip: origin tree boot crash, Len Brown, (Sat Dec 26, 1:19 pm)
Re: -tip: origin tree boot crash, Len Brown, (Sat Dec 26, 9:20 pm)
Re: -tip: origin tree boot crash, Ingo Molnar, (Mon Dec 28, 2:44 am)
Re: -tip: origin tree boot crash, Ingo Molnar, (Mon Dec 28, 5:01 am)
Re: -tip: origin tree boot crash, Paul Rolland, (Mon Dec 28, 8:02 am)
Re: -tip: origin tree boot crash, Paul Rolland, (Mon Dec 28, 9:15 am)
Re: -tip: origin tree boot crash, Paul Rolland, (Mon Dec 28, 9:53 am)
Re: -tip: origin tree boot crash, Dmitry Torokhov, (Mon Dec 28, 1:17 pm)
Re: Linux 2.6.33-rc2 - Blank screen for Intel KMS, Miguel Calleja, (Tue Dec 29, 2:50 am)
Re: Linux 2.6.33-rc2 - Blank screen for Intel KMS, Rafael J. Wysocki, (Tue Dec 29, 7:01 am)
Re: -tip: origin tree boot crash, Len Brown, (Tue Dec 29, 11:14 pm)
Re: -tip: origin tree boot crash, Paul Rolland, (Wed Dec 30, 12:13 am)
Re: drm_vm.c:drm_mmap: possible circular locking dependenc ..., Eric W. Biederman, (Wed Dec 30, 2:34 pm)
Re: drm_vm.c:drm_mmap: possible circular locking dependenc ..., Eric W. Biederman, (Thu Dec 31, 1:40 am)
Re: drm_vm.c:drm_mmap: possible circular locking dependenc ..., Eric W. Biederman, (Thu Dec 31, 1:40 am)
Re: drm_vm.c:drm_mmap: possible circular locking dependenc ..., Eric W. Biederman, (Sat Jan 2, 10:38 pm)
Re: drm_vm.c:drm_mmap: possible circular locking dependenc ..., Eric W. Biederman, (Mon Jan 4, 12:43 pm)
Re: [PATCH] sysfs: Add lockdep annotations for the sysfs a ..., Eric W. Biederman, (Sun Jan 17, 10:18 am)
Re: [PATCH] sysfs: Add lockdep annotations for the sysfs a ..., Dominik Brodowski, (Sun Jan 17, 11:03 am)