]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
EDAC: Properly unwind on failure path in edac_init()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Fri, 6 Feb 2015 06:12:42 +0000 (22:12 -0800)
committerJiri Slaby <jslaby@suse.cz>
Wed, 10 Jun 2015 11:43:11 +0000 (13:43 +0200)
commit c6b97bcf8e3ee6643a7f90a54d1ef3f9e12ec245 upstream.

edac_init() does not deallocate already allocated resources on failure
path.

Found by Linux Driver Verification project (linuxtesting.org).

 [ Boris: The unwind path functions have __exit annotation but are being
   used in an __init function, leading to section mismatches. Drop the
   section annotation and make them normal functions. ]

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Link: http://lkml.kernel.org/r/1423203162-26368-1-git-send-email-khoroshilov@ispras.ru
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/edac/edac_mc_sysfs.c
drivers/edac/edac_module.c

index e5bdf216effe19f713c6d5489f1ff865d0bd4c19..66f2ccfa5665840388964071da6b9117d64ed31a 100644 (file)
@@ -911,7 +911,7 @@ int __init edac_debugfs_init(void)
        return 0;
 }
 
-void __exit edac_debugfs_exit(void)
+void edac_debugfs_exit(void)
 {
        debugfs_remove(edac_debugfs);
 }
@@ -1165,7 +1165,7 @@ int __init edac_mc_sysfs_init(void)
        return err;
 }
 
-void __exit edac_mc_sysfs_exit(void)
+void edac_mc_sysfs_exit(void)
 {
        device_unregister(mci_pdev);
        edac_put_sysfs_subsys();
index a66941fea5a417724097837bdb6b891b07241852..afda850b0b955e9a950d9d71ff68f213400ee77b 100644 (file)
@@ -112,20 +112,23 @@ static int __init edac_init(void)
 
        err = edac_mc_sysfs_init();
        if (err)
-               goto error;
+               goto err_sysfs;
 
        edac_debugfs_init();
 
-       /* Setup/Initialize the workq for this core */
        err = edac_workqueue_setup();
        if (err) {
-               edac_printk(KERN_ERR, EDAC_MC, "init WorkQueue failure\n");
-               goto error;
+               edac_printk(KERN_ERR, EDAC_MC, "Failure initializing workqueue\n");
+               goto err_wq;
        }
 
        return 0;
 
-error:
+err_wq:
+       edac_debugfs_exit();
+       edac_mc_sysfs_exit();
+
+err_sysfs:
        return err;
 }