Skip to content

Commit

Permalink
x86, microcode: Return error from driver init code when loader is dis…
Browse files Browse the repository at this point in the history
…abled

Commits 65cef13 ("x86, microcode: Add a disable chicken bit") and
a18a0f6 ("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>
  • Loading branch information
Boris Ostrovsky authored and Borislav Petkov committed Jan 28, 2015
1 parent 26bc420 commit da63865
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/microcode/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit da63865

Please sign in to comment.