x86/microcode/intel: Guard against stack overflow in the loader
[pandora-kernel.git] / arch / x86 / kernel / cpu / microcode / intel_early.c
index ec9df6f..5e109a3 100644 (file)
@@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
        unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
        int i;
 
-       while (leftover) {
+       while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
                mc_header = (struct microcode_header_intel *)ucode_ptr;
 
                mc_size = get_totalsize(mc_header);