linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86, microcode: Return error from driver init code when loader is disabled
@ 2015-01-28  2:21 Boris Ostrovsky
  2015-01-28 11:06 ` Borislav Petkov
  2015-01-29  6:54 ` [tip:x86/urgent] " tip-bot for Boris Ostrovsky
  0 siblings, 2 replies; 3+ messages in thread
From: Boris Ostrovsky @ 2015-01-28  2:21 UTC (permalink / raw)
  To: bp; +Cc: x86, linux-kernel, james, boris.ostrovsky, stable

Commits 65cef1311d5d ("x86, microcode: Add a disable chicken bit") and
a18a0f6850d4 ("x86, microcode: Don't initialize microcode code on
paravirt") allow microcode driver skip initialization when microcode
loading is not permitted.

However, they don't prevent the driver from being loaded since the
init code returns 0. If at some point later the driver gets unloaded
this will result in an oops while trying to deregister the (never
registered) device.

To avoid this, make init code return an error on paravirt or when
microcode loading is disabled. The driver will then never be loaded.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reported-by: James Digwall <james@dingwall.me.uk>
Cc: stable@vger.kernel.org # 3.18
---
 arch/x86/kernel/cpu/microcode/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 15c2909..36a8361 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -552,7 +552,7 @@ static int __init microcode_init(void)
 	int error;
 
 	if (paravirt_enabled() || dis_ucode_ldr)
-		return 0;
+		return -EINVAL;
 
 	if (c->x86_vendor == X86_VENDOR_INTEL)
 		microcode_ops = init_intel_microcode();
-- 
1.9.3


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

* Re: [PATCH] x86, microcode: Return error from driver init code when loader is disabled
  2015-01-28  2:21 [PATCH] x86, microcode: Return error from driver init code when loader is disabled Boris Ostrovsky
@ 2015-01-28 11:06 ` Borislav Petkov
  2015-01-29  6:54 ` [tip:x86/urgent] " tip-bot for Boris Ostrovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2015-01-28 11:06 UTC (permalink / raw)
  To: Boris Ostrovsky; +Cc: x86, linux-kernel, james, stable

On Tue, Jan 27, 2015 at 09:21:09PM -0500, Boris Ostrovsky wrote:
> Commits 65cef1311d5d ("x86, microcode: Add a disable chicken bit") and
> a18a0f6850d4 ("x86, microcode: Don't initialize microcode code on
> paravirt") allow microcode driver skip initialization when microcode
> loading is not permitted.
> 
> However, they don't prevent the driver from being loaded since the
> init code returns 0. If at some point later the driver gets unloaded
> this will result in an oops while trying to deregister the (never
> registered) device.
> 
> To avoid this, make init code return an error on paravirt or when
> microcode loading is disabled. The driver will then never be loaded.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Reported-by: James Digwall <james@dingwall.me.uk>
> Cc: stable@vger.kernel.org # 3.18

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

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

* [tip:x86/urgent] x86, microcode: Return error from driver init code when loader is disabled
  2015-01-28  2:21 [PATCH] x86, microcode: Return error from driver init code when loader is disabled Boris Ostrovsky
  2015-01-28 11:06 ` Borislav Petkov
@ 2015-01-29  6:54 ` tip-bot for Boris Ostrovsky
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Boris Ostrovsky @ 2015-01-29  6:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: boris.ostrovsky, mingo, hpa, bp, tglx, james, linux-kernel

Commit-ID:  da63865a01c6384d459464e5165d95d4f04878d8
Gitweb:     http://git.kernel.org/tip/da63865a01c6384d459464e5165d95d4f04878d8
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Tue, 27 Jan 2015 21:21:09 -0500
Committer:  Borislav Petkov <bp@suse.de>
CommitDate: Wed, 28 Jan 2015 09:23:40 +0100

x86, microcode: Return error from driver init code when loader is disabled

Commits 65cef1311d5d ("x86, microcode: Add a disable chicken bit") and
a18a0f6850d4 ("x86, microcode: Don't initialize microcode code on
paravirt") allow microcode driver skip initialization when microcode
loading is not permitted.

However, they don't prevent the driver from being loaded since the
init code returns 0. If at some point later the driver gets unloaded
this will result in an oops while trying to deregister the (never
registered) device.

To avoid this, make init code return an error on paravirt or when
microcode loading is disabled. The driver will then never be loaded.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: http://lkml.kernel.org/r/1422411669-25147-1-git-send-email-boris.ostrovsky@oracle.com
Reported-by: James Digwall <james@dingwall.me.uk>
Cc: stable@vger.kernel.org # 3.18
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/microcode/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 15c2909..36a8361 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -552,7 +552,7 @@ static int __init microcode_init(void)
 	int error;
 
 	if (paravirt_enabled() || dis_ucode_ldr)
-		return 0;
+		return -EINVAL;
 
 	if (c->x86_vendor == X86_VENDOR_INTEL)
 		microcode_ops = init_intel_microcode();

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

end of thread, other threads:[~2015-01-29  6:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28  2:21 [PATCH] x86, microcode: Return error from driver init code when loader is disabled Boris Ostrovsky
2015-01-28 11:06 ` Borislav Petkov
2015-01-29  6:54 ` [tip:x86/urgent] " tip-bot for Boris Ostrovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).