Commit 74781387822cd7a549123ae2b35862bf802689be

Authored by Steffen Klassert
Committed by Herbert Xu
1 parent 50beceba7f

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>

Showing 1 changed file with 7 additions and 1 deletions Side-by-side Diff

... ... @@ -642,6 +642,9 @@
642 642 if (!pd)
643 643 goto err_free_inst;
644 644  
  645 + if (!alloc_cpumask_var(&pinst->cpumask, GFP_KERNEL))
  646 + goto err_free_pd;
  647 +
645 648 rcu_assign_pointer(pinst->pd, pd);
646 649  
647 650 pinst->wq = wq;
648 651  
... ... @@ -654,12 +657,14 @@
654 657 pinst->cpu_notifier.priority = 0;
655 658 err = register_hotcpu_notifier(&pinst->cpu_notifier);
656 659 if (err)
657   - goto err_free_pd;
  660 + goto err_free_cpumask;
658 661  
659 662 mutex_init(&pinst->lock);
660 663  
661 664 return pinst;
662 665  
  666 +err_free_cpumask:
  667 + free_cpumask_var(pinst->cpumask);
663 668 err_free_pd:
664 669 padata_free_pd(pd);
665 670 err_free_inst:
... ... @@ -685,6 +690,7 @@
685 690  
686 691 unregister_hotcpu_notifier(&pinst->cpu_notifier);
687 692 padata_free_pd(pinst->pd);
  693 + free_cpumask_var(pinst->cpumask);
688 694 kfree(pinst);
689 695 }
690 696 EXPORT_SYMBOL(padata_free);