aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/padata.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/padata.c')
-rw-r--r--kernel/padata.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/padata.c b/kernel/padata.c
index 5085046d83fb..5b44d0fa358e 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -25,6 +25,7 @@
25#include <linux/padata.h> 25#include <linux/padata.h>
26#include <linux/mutex.h> 26#include <linux/mutex.h>
27#include <linux/sched.h> 27#include <linux/sched.h>
28#include <linux/slab.h>
28#include <linux/rcupdate.h> 29#include <linux/rcupdate.h>
29 30
30#define MAX_SEQ_NR INT_MAX - NR_CPUS 31#define MAX_SEQ_NR INT_MAX - NR_CPUS
@@ -642,6 +643,9 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask,
642 if (!pd) 643 if (!pd)
643 goto err_free_inst; 644 goto err_free_inst;
644 645
646 if (!alloc_cpumask_var(&pinst->cpumask, GFP_KERNEL))
647 goto err_free_pd;
648
645 rcu_assign_pointer(pinst->pd, pd); 649 rcu_assign_pointer(pinst->pd, pd);
646 650
647 pinst->wq = wq; 651 pinst->wq = wq;
@@ -654,12 +658,14 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask,
654 pinst->cpu_notifier.priority = 0; 658 pinst->cpu_notifier.priority = 0;
655 err = register_hotcpu_notifier(&pinst->cpu_notifier); 659 err = register_hotcpu_notifier(&pinst->cpu_notifier);
656 if (err) 660 if (err)
657 goto err_free_pd; 661 goto err_free_cpumask;
658 662
659 mutex_init(&pinst->lock); 663 mutex_init(&pinst->lock);
660 664
661 return pinst; 665 return pinst;
662 666
667err_free_cpumask:
668 free_cpumask_var(pinst->cpumask);
663err_free_pd: 669err_free_pd:
664 padata_free_pd(pd); 670 padata_free_pd(pd);
665err_free_inst: 671err_free_inst:
@@ -685,6 +691,7 @@ void padata_free(struct padata_instance *pinst)
685 691
686 unregister_hotcpu_notifier(&pinst->cpu_notifier); 692 unregister_hotcpu_notifier(&pinst->cpu_notifier);
687 padata_free_pd(pinst->pd); 693 padata_free_pd(pinst->pd);
694 free_cpumask_var(pinst->cpumask);
688 kfree(pinst); 695 kfree(pinst);
689} 696}
690EXPORT_SYMBOL(padata_free); 697EXPORT_SYMBOL(padata_free);