aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2009-08-19 10:06:47 -0400
committerLen Brown <len.brown@intel.com>2009-12-09 23:59:19 -0500
commit71e9dc73cb6b1351bdd5f732cef5dbef411b3219 (patch)
tree968d57bf56ec08bfd82b600caf53626d02166990 /drivers/platform
parente1fbf346c7c56d6b2f9d835d297bcb088baaff3a (diff)
dell-laptop: fix a use-after-free error on the failure path
dell_setup_rfkill() already cleans up the rfkill devices on failure. So if it returns an error, we should not try to unregister the rfkill devices. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Acked-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/dell-laptop.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 906111152b03..d791ef93c1f0 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -330,7 +330,7 @@ static int __init dell_init(void)
330 330
331 if (ret) { 331 if (ret) {
332 printk(KERN_WARNING "dell-laptop: Unable to setup rfkill\n"); 332 printk(KERN_WARNING "dell-laptop: Unable to setup rfkill\n");
333 goto out; 333 goto fail_rfkill;
334 } 334 }
335 335
336#ifdef CONFIG_ACPI 336#ifdef CONFIG_ACPI
@@ -358,7 +358,7 @@ static int __init dell_init(void)
358 if (IS_ERR(dell_backlight_device)) { 358 if (IS_ERR(dell_backlight_device)) {
359 ret = PTR_ERR(dell_backlight_device); 359 ret = PTR_ERR(dell_backlight_device);
360 dell_backlight_device = NULL; 360 dell_backlight_device = NULL;
361 goto out; 361 goto fail_backlight;
362 } 362 }
363 363
364 dell_backlight_device->props.max_brightness = max_intensity; 364 dell_backlight_device->props.max_brightness = max_intensity;
@@ -368,13 +368,15 @@ static int __init dell_init(void)
368 } 368 }
369 369
370 return 0; 370 return 0;
371out: 371
372fail_backlight:
372 if (wifi_rfkill) 373 if (wifi_rfkill)
373 rfkill_unregister(wifi_rfkill); 374 rfkill_unregister(wifi_rfkill);
374 if (bluetooth_rfkill) 375 if (bluetooth_rfkill)
375 rfkill_unregister(bluetooth_rfkill); 376 rfkill_unregister(bluetooth_rfkill);
376 if (wwan_rfkill) 377 if (wwan_rfkill)
377 rfkill_unregister(wwan_rfkill); 378 rfkill_unregister(wwan_rfkill);
379fail_rfkill:
378 kfree(da_tokens); 380 kfree(da_tokens);
379 return ret; 381 return ret;
380} 382}