Browse Source

padata: Check for valid cpumasks

Now that we allow to change the cpumasks from userspace, we have
to check for valid cpumasks in padata_do_parallel. This patch adds
the necessary check. This fixes a division by zero crash if the
parallel cpumask contains no active cpu.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Steffen Klassert 15 năm trước cách đây
mục cha
commit
7424713b83
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      kernel/padata.c

+ 1 - 1
kernel/padata.c

@@ -114,7 +114,7 @@ int padata_do_parallel(struct padata_instance *pinst,
 	pd = rcu_dereference(pinst->pd);
 	pd = rcu_dereference(pinst->pd);
 
 
 	err = -EINVAL;
 	err = -EINVAL;
-	if (!(pinst->flags & PADATA_INIT))
+	if (!(pinst->flags & PADATA_INIT) || pinst->flags & PADATA_INVALID)
 		goto out;
 		goto out;
 
 
 	if (!cpumask_test_cpu(cb_cpu, pd->cpumask.cbcpu))
 	if (!cpumask_test_cpu(cb_cpu, pd->cpumask.cbcpu))