File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
arch/x86/kernel/cpu/microcode Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -486,6 +486,16 @@ static void __exit microcode_dev_exit(void)
486
486
/* fake device for request_firmware */
487
487
static struct platform_device * microcode_pdev ;
488
488
489
+ static int check_online_cpus (void )
490
+ {
491
+ if (num_online_cpus () == num_present_cpus ())
492
+ return 0 ;
493
+
494
+ pr_err ("Not all CPUs online, aborting microcode update.\n" );
495
+
496
+ return - EINVAL ;
497
+ }
498
+
489
499
static enum ucode_state reload_for_cpu (int cpu )
490
500
{
491
501
struct ucode_cpu_info * uci = ucode_cpu_info + cpu ;
@@ -519,7 +529,13 @@ static ssize_t reload_store(struct device *dev,
519
529
return size ;
520
530
521
531
get_online_cpus ();
532
+
533
+ ret = check_online_cpus ();
534
+ if (ret )
535
+ goto put ;
536
+
522
537
mutex_lock (& microcode_mutex );
538
+
523
539
for_each_online_cpu (cpu ) {
524
540
tmp_ret = reload_for_cpu (cpu );
525
541
if (tmp_ret > UCODE_NFOUND ) {
@@ -538,6 +554,8 @@ static ssize_t reload_store(struct device *dev,
538
554
microcode_check ();
539
555
540
556
mutex_unlock (& microcode_mutex );
557
+
558
+ put :
541
559
put_online_cpus ();
542
560
543
561
if (!ret )
You can’t perform that action at this time.
0 commit comments