x86, intel_cacheinfo: fix use-after-free cache_kobject

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>
This commit is contained in:
Akinobu Mita 2008-07-15 17:09:03 +09:00 коммит произвёл Ingo Molnar
Родитель 2b7207a6b5
Коммит 8b2b9c1af0
1 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -780,15 +780,14 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
} }
kobject_put(per_cpu(cache_kobject, cpu)); kobject_put(per_cpu(cache_kobject, cpu));
cpuid4_cache_sysfs_exit(cpu); cpuid4_cache_sysfs_exit(cpu);
break; return retval;
} }
kobject_uevent(&(this_object->kobj), KOBJ_ADD); 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); kobject_uevent(per_cpu(cache_kobject, cpu), KOBJ_ADD);
return retval; return 0;
} }
static void __cpuinit cache_remove_dev(struct sys_device * sys_dev) static void __cpuinit cache_remove_dev(struct sys_device * sys_dev)