aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2015-02-06 01:12:42 -0500
committerBorislav Petkov <bp@suse.de>2015-02-23 07:13:07 -0500
commitc6b97bcf8e3ee6643a7f90a54d1ef3f9e12ec245 (patch)
treee95d43f3b02159c2f70e2fbbdd564415509173c9 /drivers/edac
parentfc7cc6b7820b54119821a3c6838ff583d796a2ab (diff)
EDAC: Properly unwind on failure path in edac_init()
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>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/edac_mc_sysfs.c4
-rw-r--r--drivers/edac/edac_module.c13
2 files changed, 10 insertions, 7 deletions
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 3a283819970b..112d63ad1154 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -914,7 +914,7 @@ int __init edac_debugfs_init(void)
914 return 0; 914 return 0;
915} 915}
916 916
917void __exit edac_debugfs_exit(void) 917void edac_debugfs_exit(void)
918{ 918{
919 debugfs_remove(edac_debugfs); 919 debugfs_remove(edac_debugfs);
920} 920}
@@ -1155,7 +1155,7 @@ int __init edac_mc_sysfs_init(void)
1155 return err; 1155 return err;
1156} 1156}
1157 1157
1158void __exit edac_mc_sysfs_exit(void) 1158void edac_mc_sysfs_exit(void)
1159{ 1159{
1160 device_unregister(mci_pdev); 1160 device_unregister(mci_pdev);
1161 edac_put_sysfs_subsys(); 1161 edac_put_sysfs_subsys();
diff --git a/drivers/edac/edac_module.c b/drivers/edac/edac_module.c
index e6d1691dfa45..9cb082a19d8a 100644
--- a/drivers/edac/edac_module.c
+++ b/drivers/edac/edac_module.c
@@ -112,20 +112,23 @@ static int __init edac_init(void)
112 112
113 err = edac_mc_sysfs_init(); 113 err = edac_mc_sysfs_init();
114 if (err) 114 if (err)
115 goto error; 115 goto err_sysfs;
116 116
117 edac_debugfs_init(); 117 edac_debugfs_init();
118 118
119 /* Setup/Initialize the workq for this core */
120 err = edac_workqueue_setup(); 119 err = edac_workqueue_setup();
121 if (err) { 120 if (err) {
122 edac_printk(KERN_ERR, EDAC_MC, "init WorkQueue failure\n"); 121 edac_printk(KERN_ERR, EDAC_MC, "Failure initializing workqueue\n");
123 goto error; 122 goto err_wq;
124 } 123 }
125 124
126 return 0; 125 return 0;
127 126
128error: 127err_wq:
128 edac_debugfs_exit();
129 edac_mc_sysfs_exit();
130
131err_sysfs:
129 return err; 132 return err;
130} 133}
131 134