diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 2ba51db8810fd6..7d079726688a72 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -281,25 +281,27 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est, spin_lock_init(&p->tcfa_lock); /* user doesn't specify an index */ if (!index) { + idr_preload(GFP_KERNEL); spin_lock_bh(&idrinfo->lock); err = idr_alloc_ext(idr, NULL, &idr_index, 1, 0, - GFP_KERNEL); + GFP_ATOMIC); spin_unlock_bh(&idrinfo->lock); + idr_preload_end(); if (err) { err3: free_percpu(p->cpu_qstats); goto err2; } p->tcfa_index = idr_index; - } - else { + } else { + idr_preload(GFP_KERNEL); spin_lock_bh(&idrinfo->lock); err = idr_alloc_ext(idr, NULL, NULL, index, index + 1, - GFP_KERNEL); + GFP_ATOMIC); spin_unlock_bh(&idrinfo->lock); - if (err) { + idr_preload_end(); + if (err) goto err3; - } p->tcfa_index = index; }