瀏覽代碼

crypto: camellia_aesni_avx - Fix CPU feature checks

We need to explicitly check the AVX and AES CPU features, as we can't
infer them from the related XSAVE feature flags.  For example, the
Core i3 2310M passes the XSAVE feature test but does not implement
AES-NI.

Reported-and-tested-by: Stéphane Glondu <glondu@debian.org>
References: https://bugs.debian.org/800934
Fixes: ce4f5f9b65ae ("x86/fpu, crypto x86/camellia_aesni_avx: Simplify...")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: stable <stable@vger.kernel.org> # 4.2
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Ben Hutchings 10 年之前
父節點
當前提交
92b279070d
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      arch/x86/crypto/camellia_aesni_avx_glue.c

+ 5 - 0
arch/x86/crypto/camellia_aesni_avx_glue.c

@@ -554,6 +554,11 @@ static int __init camellia_aesni_init(void)
 {
 {
 	const char *feature_name;
 	const char *feature_name;
 
 
+	if (!cpu_has_avx || !cpu_has_aes || !cpu_has_osxsave) {
+		pr_info("AVX or AES-NI instructions are not detected.\n");
+		return -ENODEV;
+	}
+
 	if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
 	if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
 		pr_info("CPU feature '%s' is not supported.\n", feature_name);
 		pr_info("CPU feature '%s' is not supported.\n", feature_name);
 		return -ENODEV;
 		return -ENODEV;