On 08.08.2015 21:47, Borislav Petkov wrote:
> On Sat, Aug 08, 2015 at 08:41:56AM -0700, Greg KH wrote:
>> What commit caused this issue?
> 
> Apparently
> 
>  0d55ba46bfbe ("x86/cacheinfo: Move cacheinfo sysfs code to generic 
> infrastructure")
> 
> Looks like moving x86 to the generic cacheinfo stuff uncovered this
> shortcoming there...
> 
>> And it's a bit late for 4.2, as you say 4.1 is also affected, I'll wait
>> for 4.3-rc1 to give this a chance to get some testing.
> 
> Right, I guess that's fine too as it'll trickle to stable eventually...
> 
> Thanks.
> 

Just a note from my end. Seems this patch didn't made it into 4.3-rc1.
Any reason why?
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
index 764280a91776..e9fd32e91668 100644
--- a/drivers/base/cacheinfo.c
+++ b/drivers/base/cacheinfo.c
@@ -148,7 +148,11 @@ static void cache_shared_cpu_map_remove(unsigned int cpu)
 
 			if (sibling == cpu) /* skip itself */
 				continue;
+
 			sib_cpu_ci = get_cpu_cacheinfo(sibling);
+			if (!sib_cpu_ci->info_list)
+				continue;
+
 			sib_leaf = sib_cpu_ci->info_list + index;
 			cpumask_clear_cpu(cpu, &sib_leaf->shared_cpu_map);
 			cpumask_clear_cpu(sibling, &this_leaf->shared_cpu_map);
@@ -159,6 +163,9 @@ static void cache_shared_cpu_map_remove(unsigned int cpu)
 
 static void free_cache_attributes(unsigned int cpu)
 {
+	if (!per_cpu_cacheinfo(cpu))
+		return;
+
 	cache_shared_cpu_map_remove(cpu);
 
 	kfree(per_cpu_cacheinfo(cpu));
@@ -514,8 +521,7 @@ static int cacheinfo_cpu_callback(struct notifier_block *nfb,
 		break;
 	case CPU_DEAD:
 		cache_remove_dev(cpu);
-		if (per_cpu_cacheinfo(cpu))
-			free_cache_attributes(cpu);
+		free_cache_attributes(cpu);
 		break;
 	}
 	return notifier_from_errno(rc);

Reply via email to