Skip to content

Commit 7478138

Browse files
klassertherbertx
authored andcommitted
padata: Allocate the cpumask for the padata instance
The cpumask of the padata instance was used without allocated. This caused boot crashes if CONFIG_CPUMASK_OFFSTACK is enabled. This patch fixes this by doing proper allocation for this cpumask. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 50beceb commit 7478138

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎kernel/padata.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,9 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask,
642642
if (!pd)
643643
goto err_free_inst;
644644

645+
if (!alloc_cpumask_var(&pinst->cpumask, GFP_KERNEL))
646+
goto err_free_pd;
647+
645648
rcu_assign_pointer(pinst->pd, pd);
646649

647650
pinst->wq = wq;
@@ -654,12 +657,14 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask,
654657
pinst->cpu_notifier.priority = 0;
655658
err = register_hotcpu_notifier(&pinst->cpu_notifier);
656659
if (err)
657-
goto err_free_pd;
660+
goto err_free_cpumask;
658661

659662
mutex_init(&pinst->lock);
660663

661664
return pinst;
662665

666+
err_free_cpumask:
667+
free_cpumask_var(pinst->cpumask);
663668
err_free_pd:
664669
padata_free_pd(pd);
665670
err_free_inst:
@@ -685,6 +690,7 @@ void padata_free(struct padata_instance *pinst)
685690

686691
unregister_hotcpu_notifier(&pinst->cpu_notifier);
687692
padata_free_pd(pinst->pd);
693+
free_cpumask_var(pinst->cpumask);
688694
kfree(pinst);
689695
}
690696
EXPORT_SYMBOL(padata_free);

0 commit comments

Comments
 (0)