]> xenbits.xensource.com Git - xen.git/commitdiff
x86/microcode: Add missing unlock in microcode_update_helper()
authorAlejandro Vallejo <alejandro.vallejo@cloud.com>
Mon, 17 Jul 2023 06:34:11 +0000 (08:34 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 17 Jul 2023 06:34:11 +0000 (08:34 +0200)
microcode_update_helper() may return early while holding
cpu_add_remove_lock, hence preventing any writers from taking it again.

Leave through the `put` label instead so it's properly released.

Fixes: 5ed12565aa32 ("microcode: rendezvous CPUs in NMI handler and load ucode")
Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: b35b22acb887f682efe8385b3df165220bc84c86
master date: 2023-06-05 16:11:10 +0100

xen/arch/x86/cpu/microcode/core.c

index ad150e5963a04af59e7994c3c3a4b28c4675e382..cd942130f5dd7defc60354669c6a70c1597cb48c 100644 (file)
@@ -594,7 +594,8 @@ static long microcode_update_helper(void *data)
         printk(XENLOG_WARNING
                "CPU%u is expected to lead ucode loading (but got CPU%u)\n",
                nmi_cpu, cpumask_first(&cpu_online_map));
-        return -EPERM;
+        ret = -EPERM;
+        goto put;
     }
 
     patch = parse_blob(buffer->buffer, buffer->len);