提交 71e9dc73 编写于 作者: A Alan Jenkins 提交者: Len Brown

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: NAlan Jenkins <alan-jenkins@tuffmail.co.uk>
Acked-by: NMatthew Garrett <mjg@redhat.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 e1fbf346
......@@ -330,7 +330,7 @@ static int __init dell_init(void)
if (ret) {
printk(KERN_WARNING "dell-laptop: Unable to setup rfkill\n");
goto out;
goto fail_rfkill;
}
#ifdef CONFIG_ACPI
......@@ -358,7 +358,7 @@ static int __init dell_init(void)
if (IS_ERR(dell_backlight_device)) {
ret = PTR_ERR(dell_backlight_device);
dell_backlight_device = NULL;
goto out;
goto fail_backlight;
}
dell_backlight_device->props.max_brightness = max_intensity;
......@@ -368,13 +368,15 @@ static int __init dell_init(void)
}
return 0;
out:
fail_backlight:
if (wifi_rfkill)
rfkill_unregister(wifi_rfkill);
if (bluetooth_rfkill)
rfkill_unregister(bluetooth_rfkill);
if (wwan_rfkill)
rfkill_unregister(wwan_rfkill);
fail_rfkill:
kfree(da_tokens);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册