Skip to content

Commit

Permalink
crypto: pcrypt - Dont calulate a callback cpu on empty callback cpumask
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
klassert authored and herbertx committed Jul 26, 2010
1 parent 7424713 commit cc74f4b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crypto/pcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cc74f4b

Please sign in to comment.