All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86 Microcode: Fix the failure path of microcode update driver init code
@ 2011-11-07 12:35 Srivatsa S. Bhat
  2011-11-07 18:02 ` Borislav Petkov
  2011-12-02 13:35 ` [PATCH] x86: fix error paths in microcode_init() Jan Beulich
  0 siblings, 2 replies; 14+ messages in thread
From: Srivatsa S. Bhat @ 2011-11-07 12:35 UTC (permalink / raw)
  To: tigran
  Cc: tglx, bp, mingo, hpa, andreas.herrmann3, amd64-microcode, x86,
	linux-kernel

The microcode update driver's initialization code does not handle failures
correctly. This patch fixes this issue.

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 arch/x86/kernel/microcode_core.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index f2d2a66..c7bdbfa 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -519,10 +519,8 @@ static int __init microcode_init(void)
 
 	microcode_pdev = platform_device_register_simple("microcode", -1,
 							 NULL, 0);
-	if (IS_ERR(microcode_pdev)) {
-		microcode_dev_exit();
+	if (IS_ERR(microcode_pdev))
 		return PTR_ERR(microcode_pdev);
-	}
 
 	get_online_cpus();
 	mutex_lock(&microcode_mutex);
@@ -532,14 +530,12 @@ static int __init microcode_init(void)
 	mutex_unlock(&microcode_mutex);
 	put_online_cpus();
 
-	if (error) {
-		platform_device_unregister(microcode_pdev);
-		return error;
-	}
+	if (error)
+		goto out_pdev;
 
 	error = microcode_dev_init();
 	if (error)
-		return error;
+		goto out_sysdev_driver;
 
 	register_syscore_ops(&mc_syscore_ops);
 	register_hotcpu_notifier(&mc_cpu_notifier);
@@ -548,6 +544,13 @@ static int __init microcode_init(void)
 		" <tigran@aivazian.fsnet.co.uk>, Peter Oruba\n");
 
 	return 0;
+
+out_sysdev_driver:
+	sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver);
+out_pdev:
+	platform_device_unregister(microcode_pdev);
+	return error;
+
 }
 module_init(microcode_init);
 


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-12-05 17:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-07 12:35 [PATCH] x86 Microcode: Fix the failure path of microcode update driver init code Srivatsa S. Bhat
2011-11-07 18:02 ` Borislav Petkov
2011-12-02 13:35 ` [PATCH] x86: fix error paths in microcode_init() Jan Beulich
2011-12-02 14:35   ` Borislav Petkov
2011-12-02 14:53     ` Jan Beulich
2011-12-02 15:15       ` Srivatsa S. Bhat
2011-12-02 15:24         ` Borislav Petkov
2011-12-02 15:33           ` Jan Beulich
2011-12-02 16:40             ` Srivatsa S. Bhat
2011-12-02 16:45               ` Jan Beulich
2011-12-02 16:51                 ` Srivatsa S. Bhat
2011-12-02 19:45                   ` Borislav Petkov
2011-12-02 20:00                     ` Srivatsa S. Bhat
2011-12-05 17:39   ` [tip:x86/urgent] x86, microcode: Fix the failure path of microcode update driver init code tip-bot for Srivatsa S. Bhat

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.