Commit 74781387 authored by Steffen Klassert's avatar Steffen Klassert Committed by Herbert Xu

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: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 50beceba
...@@ -642,6 +642,9 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask, ...@@ -642,6 +642,9 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask,
if (!pd) if (!pd)
goto err_free_inst; goto err_free_inst;
if (!alloc_cpumask_var(&pinst->cpumask, GFP_KERNEL))
goto err_free_pd;
rcu_assign_pointer(pinst->pd, pd); rcu_assign_pointer(pinst->pd, pd);
pinst->wq = wq; pinst->wq = wq;
...@@ -654,12 +657,14 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask, ...@@ -654,12 +657,14 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask,
pinst->cpu_notifier.priority = 0; pinst->cpu_notifier.priority = 0;
err = register_hotcpu_notifier(&pinst->cpu_notifier); err = register_hotcpu_notifier(&pinst->cpu_notifier);
if (err) if (err)
goto err_free_pd; goto err_free_cpumask;
mutex_init(&pinst->lock); mutex_init(&pinst->lock);
return pinst; return pinst;
err_free_cpumask:
free_cpumask_var(pinst->cpumask);
err_free_pd: err_free_pd:
padata_free_pd(pd); padata_free_pd(pd);
err_free_inst: err_free_inst:
...@@ -685,6 +690,7 @@ void padata_free(struct padata_instance *pinst) ...@@ -685,6 +690,7 @@ void padata_free(struct padata_instance *pinst)
unregister_hotcpu_notifier(&pinst->cpu_notifier); unregister_hotcpu_notifier(&pinst->cpu_notifier);
padata_free_pd(pinst->pd); padata_free_pd(pinst->pd);
free_cpumask_var(pinst->cpumask);
kfree(pinst); kfree(pinst);
} }
EXPORT_SYMBOL(padata_free); EXPORT_SYMBOL(padata_free);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment