Skip to contentSkip to conversation

WMI: properly cleanup devices to avoid crashes

PATCH In review Dmitry Torokhov 2 participants 3 messages Sep 7, 2011 – Oct 8, 2011 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 WMI: properly cleanup devices to avoid crashes

We need to remove devices that we destroy from the list, otherwise we'll crash if there are more than one "_WDG" methods in DSDT.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=32052

---

 drivers/platform/x86/wmi.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/platform/x86/wmi.c +5 -1
index f23d5a8..9b88be4 100644
@@ -754,9 +754,13 @@ static void wmi_free_devices(void)
 	struct wmi_block *wblock, *next;
 
 	/* Delete devices for all the GUIDs */
-	list_for_each_entry_safe(wblock, next, &wmi_block_list, list)
+	list_for_each_entry_safe(wblock, next, &wmi_block_list, list) {
+		list_del(&wblock->list);
 		if (wblock->dev.class)
 			device_unregister(&wblock->dev);
+		else
+			kfree(wblock);
+	}
 }
 
 static bool guid_already_parsed(const char *guid_string)
#1 lore raw
Quoted 9 lines · Dmitry Torokhov

We need to remove devices that we destroy from the list, otherwise we'll crash if there are more than one "_WDG" methods in DSDT.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=32052

---

* ping *

Quoted 24 lines
 drivers/platform/x86/wmi.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/platform/x86/wmi.c +5 -1
index f23d5a8..9b88be4 100644
@@ -754,9 +754,13 @@ static void wmi_free_devices(void)
 	struct wmi_block *wblock, *next;
 
 	/* Delete devices for all the GUIDs */
-	list_for_each_entry_safe(wblock, next, &wmi_block_list, list)
+	list_for_each_entry_safe(wblock, next, &wmi_block_list, list) {
+		list_del(&wblock->list);
 		if (wblock->dev.class)
 			device_unregister(&wblock->dev);
+		else
+			kfree(wblock);
+	}
 }
 
 static bool guid_already_parsed(const char *guid_string)
Signature · 1 line
Dmitry
#2 lore raw
Quoted 9 lines · On Thursday 06 Oct 2011 15:40:44 Dmitry Torokhov wrote:
Quoted 8 lines · Dmitry Torokhov

We need to remove devices that we destroy from the list, otherwise we'll crash if there are more than one "_WDG" methods in DSDT.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=32052

Quoted 32 lines
Quoted 1 line

---

* ping *

Quoted 28 lines
 drivers/platform/x86/wmi.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/platform/x86/wmi.c +5 -1
index f23d5a8..9b88be4 100644
@@ -754,9 +754,13 @@ static void wmi_free_devices(void)
 
 	struct wmi_block *wblock, *next;
 
 	/* Delete devices for all the GUIDs */
 
-	list_for_each_entry_safe(wblock, next, &wmi_block_list, list)
+	list_for_each_entry_safe(wblock, next, &wmi_block_list, list) {
+		list_del(&wblock->list);
 
 		if (wblock->dev.class)
 
 			device_unregister(&wblock->dev);
 
+		else
+			kfree(wblock);
+	}
 
 }
 
 static bool guid_already_parsed(const char *guid_string)