Quellcode durchsuchen

kernel: add MIPS kernel fix for an uninitialized CPU map

Signed-off-by: Felix Fietkau <[email protected]>

SVN-Revision: 48956
Felix Fietkau vor 10 Jahren
Ursprung
Commit
b9f52b6b86

+ 31 - 0
target/linux/generic/patches-4.4/103-MIPS-smp.c-Fix-uninitialised-temp_foreign_map.patch

@@ -0,0 +1,31 @@
+From: James Hogan <[email protected]>
+Date: Fri, 4 Mar 2016 10:10:51 +0000
+Subject: [PATCH] MIPS: smp.c: Fix uninitialised temp_foreign_map
+
+When calculate_cpu_foreign_map() recalculates the cpu_foreign_map
+cpumask it uses the local variable temp_foreign_map without initialising
+it to zero. Since the calculation only ever sets bits in this cpumask
+any existing bits at that memory location will remain set and find their
+way into cpu_foreign_map too. This could potentially lead to cache
+operations suboptimally doing smp calls to multiple VPEs in the same
+core, even though the VPEs share primary caches.
+
+Therefore initialise temp_foreign_map using cpumask_clear() before use.
+
+Fixes: cccf34e9411c ("MIPS: c-r4k: Fix cache flushing for MT cores")
+Signed-off-by: James Hogan <[email protected]>
+Cc: Ralf Baechle <[email protected]>
+Cc: Paul Burton <[email protected]>
+Cc: [email protected]
+---
+
+--- a/arch/mips/kernel/smp.c
++++ b/arch/mips/kernel/smp.c
+@@ -121,6 +121,7 @@ static inline void calculate_cpu_foreign
+ 	cpumask_t temp_foreign_map;
+ 
+ 	/* Re-calculate the mask */
++	cpumask_clear(&temp_foreign_map);
+ 	for_each_online_cpu(i) {
+ 		core_present = 0;
+ 		for_each_cpu(k, &temp_foreign_map)