Skip to content

Commit cc74f4b

Browse files
klassertherbertx
authored andcommitted
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>
1 parent 7424713 commit cc74f4b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎crypto/pcrypt.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu,
8282
if (cpumask_test_cpu(cpu, cpumask->mask))
8383
goto out;
8484

85+
if (!cpumask_weight(cpumask->mask))
86+
goto out;
87+
8588
cpu_index = cpu % cpumask_weight(cpumask->mask);
8689

8790
cpu = cpumask_first(cpumask->mask);

0 commit comments

Comments
 (0)