Explorar o código

crypto: pcrypt - Dont calulate a callback cpu on empty callback cpumask

If the callback cpumask is empty, we crash with a division by zero
when we try to calculate a callback cpu. So we don't update the callback
cpu in pcrypt_do_parallel if the callback cpumask is empty.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Steffen Klassert %!s(int64=15) %!d(string=hai) anos
pai
achega
cc74f4bc11
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      crypto/pcrypt.c

+ 3 - 0
crypto/pcrypt.c

@@ -82,6 +82,9 @@ static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu,
 	if (cpumask_test_cpu(cpu, cpumask->mask))
 			goto out;
 
+	if (!cpumask_weight(cpumask->mask))
+			goto out;
+
 	cpu_index = cpu % cpumask_weight(cpumask->mask);
 
 	cpu = cpumask_first(cpumask->mask);