diff options
author | Chuck Ebbert <cebbert@redhat.com> | 2007-08-07 11:27:41 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-08-09 14:27:46 -0700 |
commit | 2547c387c41e5dda43f7a484a46b40ae0b491aef (patch) | |
tree | 36ebf6732c916bf04b873ef4f78db5e61b045979 | |
parent | 749de926ff8a21e94a6771ad02fff49d99dc2a90 (diff) | |
download | lwn-2547c387c41e5dda43f7a484a46b40ae0b491aef.tar.gz lwn-2547c387c41e5dda43f7a484a46b40ae0b491aef.zip |
ACPI: dock: fix opps after dock driver fails to initialize
ACPI: dock: fix opps after dock driver fails to initialize
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@redhat.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/acpi/dock.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 4546bf873aea..9bc340b870d1 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c @@ -716,6 +716,7 @@ static int dock_add(acpi_handle handle) if (ret) { printk(KERN_ERR PREFIX "Error %d registering dock device\n", ret); kfree(dock_station); + dock_station = NULL; return ret; } ret = device_create_file(&dock_device.dev, &dev_attr_docked); @@ -723,6 +724,7 @@ static int dock_add(acpi_handle handle) printk("Error %d adding sysfs file\n", ret); platform_device_unregister(&dock_device); kfree(dock_station); + dock_station = NULL; return ret; } ret = device_create_file(&dock_device.dev, &dev_attr_undock); @@ -731,6 +733,7 @@ static int dock_add(acpi_handle handle) device_remove_file(&dock_device.dev, &dev_attr_docked); platform_device_unregister(&dock_device); kfree(dock_station); + dock_station = NULL; return ret; } ret = device_create_file(&dock_device.dev, &dev_attr_uid); @@ -738,6 +741,7 @@ static int dock_add(acpi_handle handle) printk("Error %d adding sysfs file\n", ret); platform_device_unregister(&dock_device); kfree(dock_station); + dock_station = NULL; return ret; } @@ -750,6 +754,7 @@ static int dock_add(acpi_handle handle) dd = alloc_dock_dependent_device(handle); if (!dd) { kfree(dock_station); + dock_station = NULL; ret = -ENOMEM; goto dock_add_err_unregister; } @@ -777,6 +782,7 @@ dock_add_err_unregister: device_remove_file(&dock_device.dev, &dev_attr_undock); platform_device_unregister(&dock_device); kfree(dock_station); + dock_station = NULL; return ret; } @@ -810,6 +816,7 @@ static int dock_remove(void) /* free dock station memory */ kfree(dock_station); + dock_station = NULL; return 0; } |