]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
firmware: fix detecting error on register_reboot_notifier()
authorLuis R. Rodriguez <mcgrof@kernel.org>
Mon, 20 Nov 2017 17:45:34 +0000 (09:45 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Nov 2017 10:07:00 +0000 (11:07 +0100)
register_reboot_notifier() can fail, detect this and address this
failure. This has been broken since v3.11, however the chances of
this failing here is really low.

Fixes: fe304143b0c3d ("firmware: Avoid deadlock of usermodehelper lock at shutdown")
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/firmware_class.c

index 3340a17e0499998a07e81e6d17221577eb73cc64..7ab54f2b032f6fd458d8c0b97a053ac6b1ced1a7 100644 (file)
@@ -1860,8 +1860,15 @@ static int __init firmware_class_init(void)
        if (ret)
                return ret;
 
-       register_reboot_notifier(&fw_shutdown_nb);
+       ret = register_reboot_notifier(&fw_shutdown_nb);
+       if (ret)
+               goto out;
+
        return register_sysfs_loader();
+
+out:
+       unregister_fw_pm_ops();
+       return ret;
 }
 
 static void __exit firmware_class_exit(void)