Skip to content

Commit

Permalink
x86, intel_cacheinfo: fix use-after-free cache_kobject
Browse files Browse the repository at this point in the history
This avoids calling kobject_uevent() with cache_kobject that has
already been deallocated in an error path.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Akinobu Mita authored and Ingo Molnar committed Jul 18, 2008
1 parent 2b7207a commit 8b2b9c1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions arch/x86/kernel/cpu/intel_cacheinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,15 +780,14 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
}
kobject_put(per_cpu(cache_kobject, cpu));
cpuid4_cache_sysfs_exit(cpu);
break;
return retval;
}
kobject_uevent(&(this_object->kobj), KOBJ_ADD);
}
if (!retval)
cpu_set(cpu, cache_dev_map);
cpu_set(cpu, cache_dev_map);

kobject_uevent(per_cpu(cache_kobject, cpu), KOBJ_ADD);
return retval;
return 0;
}

static void __cpuinit cache_remove_dev(struct sys_device * sys_dev)
Expand Down

0 comments on commit 8b2b9c1

Please sign in to comment.