+ acpi-fix-oops-after-dock-driver-fails-to-initialize.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     ACPI: fix oops after dock driver fails to initialize
has been added to the -mm tree.  Its filename is
     acpi-fix-oops-after-dock-driver-fails-to-initialize.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: ACPI: fix oops after dock driver fails to initialize
From: Chuck Ebbert <cebbert@xxxxxxxxxx>

The driver tests the dock_station pointer for nonnull to check whether it has
initialized properly.  But in some cases dock_station will be non-null after
being freed when driver init fails.  Fix by zeroing the pointer after freeing.

Signed-off-by: Chuck Ebbert <cebbert@xxxxxxxxxx>
Cc: Kristen Carlson Accardi <kristen.c.accardi@xxxxxxxxx>
Cc: Len Brown <lenb@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/acpi/dock.c |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diff -puN drivers/acpi/dock.c~acpi-fix-oops-after-dock-driver-fails-to-initialize drivers/acpi/dock.c
--- a/drivers/acpi/dock.c~acpi-fix-oops-after-dock-driver-fails-to-initialize
+++ a/drivers/acpi/dock.c
@@ -714,31 +714,24 @@ static int dock_add(acpi_handle handle)
 	dock_device.name = dock_device_name;
 	ret = platform_device_register(&dock_device);
 	if (ret) {
-		printk(KERN_ERR PREFIX "Error %d registering dock device\n", ret);
-		kfree(dock_station);
-		return ret;
+		printk(KERN_ERR PREFIX "Error %d registering dock device\n",
+				ret);
+		goto err;
 	}
 	ret = device_create_file(&dock_device.dev, &dev_attr_docked);
 	if (ret) {
 		printk("Error %d adding sysfs file\n", ret);
-		platform_device_unregister(&dock_device);
-		kfree(dock_station);
-		return ret;
+		goto err_register;
 	}
 	ret = device_create_file(&dock_device.dev, &dev_attr_undock);
 	if (ret) {
 		printk("Error %d adding sysfs file\n", ret);
-		device_remove_file(&dock_device.dev, &dev_attr_docked);
-		platform_device_unregister(&dock_device);
-		kfree(dock_station);
-		return ret;
+		goto err_sysfs_1;
 	}
 	ret = device_create_file(&dock_device.dev, &dev_attr_uid);
 	if (ret) {
 		printk("Error %d adding sysfs file\n", ret);
-		platform_device_unregister(&dock_device);
-		kfree(dock_station);
-		return ret;
+		goto err_sysfs_2;
 	}
 
 	/* Find dependent devices */
@@ -749,7 +742,6 @@ static int dock_add(acpi_handle handle)
 	/* add the dock station as a device dependent on itself */
 	dd = alloc_dock_dependent_device(handle);
 	if (!dd) {
-		kfree(dock_station);
 		ret = -ENOMEM;
 		goto dock_add_err_unregister;
 	}
@@ -773,10 +765,15 @@ static int dock_add(acpi_handle handle)
 dock_add_err:
 	kfree(dd);
 dock_add_err_unregister:
+err_sysfs_2:
 	device_remove_file(&dock_device.dev, &dev_attr_docked);
+err_sysfs_1:
 	device_remove_file(&dock_device.dev, &dev_attr_undock);
+err_register:
 	platform_device_unregister(&dock_device);
+err:
 	kfree(dock_station);
+	dock_station = NULL;
 	return ret;
 }
 
@@ -810,6 +807,7 @@ static int dock_remove(void)
 
 	/* free dock station memory */
 	kfree(dock_station);
+	dock_station = NULL;
 	return 0;
 }
 
_

Patches currently in -mm which might be from cebbert@xxxxxxxxxx are

origin.patch
acpi-fix-oops-after-dock-driver-fails-to-initialize.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux