mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									fc7cc6b782
								
							
						
					
					
						commit
						c6b97bcf8e
					
				
					 2 changed files with 10 additions and 7 deletions
				
			
		| 
						 | 
					@ -914,7 +914,7 @@ int __init edac_debugfs_init(void)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void __exit edac_debugfs_exit(void)
 | 
					void edac_debugfs_exit(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	debugfs_remove(edac_debugfs);
 | 
						debugfs_remove(edac_debugfs);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1155,7 +1155,7 @@ int __init edac_mc_sysfs_init(void)
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void __exit edac_mc_sysfs_exit(void)
 | 
					void edac_mc_sysfs_exit(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	device_unregister(mci_pdev);
 | 
						device_unregister(mci_pdev);
 | 
				
			||||||
	edac_put_sysfs_subsys();
 | 
						edac_put_sysfs_subsys();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -112,20 +112,23 @@ static int __init edac_init(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = edac_mc_sysfs_init();
 | 
						err = edac_mc_sysfs_init();
 | 
				
			||||||
	if (err)
 | 
						if (err)
 | 
				
			||||||
		goto error;
 | 
							goto err_sysfs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	edac_debugfs_init();
 | 
						edac_debugfs_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Setup/Initialize the workq for this core */
 | 
					 | 
				
			||||||
	err = edac_workqueue_setup();
 | 
						err = edac_workqueue_setup();
 | 
				
			||||||
	if (err) {
 | 
						if (err) {
 | 
				
			||||||
		edac_printk(KERN_ERR, EDAC_MC, "init WorkQueue failure\n");
 | 
							edac_printk(KERN_ERR, EDAC_MC, "Failure initializing workqueue\n");
 | 
				
			||||||
		goto error;
 | 
							goto err_wq;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
error:
 | 
					err_wq:
 | 
				
			||||||
 | 
						edac_debugfs_exit();
 | 
				
			||||||
 | 
						edac_mc_sysfs_exit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					err_sysfs:
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue