瀏覽代碼

x86: cacheinfo: correct return value when cache_disable feature is not active

Impact: bug fix

If user writes to "cache_disable" attribute on a CPU that does not support
this feature, the process hangs due to an invalid return value in
store_cache_disable().

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mark Langsdorf <mark.langsdorf@amd.com>
LKML-Reference: <20090409130729.GH31527@alberich.amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Andreas Herrmann 16 年之前
父節點
當前提交
845d8c761e
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      arch/x86/kernel/cpu/intel_cacheinfo.c

+ 1 - 1
arch/x86/kernel/cpu/intel_cacheinfo.c

@@ -771,7 +771,7 @@ store_cache_disable(struct _cpuid4_info *this_leaf, const char *buf,
 	unsigned int ret, index, val;
 	unsigned int ret, index, val;
 
 
 	if (!this_leaf->can_disable)
 	if (!this_leaf->can_disable)
-		return 0;
+		return -EINVAL;
 
 
 	if (strlen(buf) > 15)
 	if (strlen(buf) > 15)
 		return -EINVAL;
 		return -EINVAL;