Skip to content

Commit a05c2d1

Browse files
congwangdavem330
authored andcommitted
net_sched: move tp->root allocation into route4_init()
Cc: Jamal Hadi Salim <[email protected]> Signed-off-by: Cong Wang <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2490c65 commit a05c2d1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

net/sched/cls_route.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,13 @@ static unsigned long route4_get(struct tcf_proto *tp, u32 handle)
258258

259259
static int route4_init(struct tcf_proto *tp)
260260
{
261+
struct route4_head *head;
262+
263+
head = kzalloc(sizeof(struct route4_head), GFP_KERNEL);
264+
if (head == NULL)
265+
return -ENOBUFS;
266+
267+
rcu_assign_pointer(tp->root, head);
261268
return 0;
262269
}
263270

@@ -484,13 +491,6 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
484491
return -EINVAL;
485492

486493
err = -ENOBUFS;
487-
if (head == NULL) {
488-
head = kzalloc(sizeof(struct route4_head), GFP_KERNEL);
489-
if (head == NULL)
490-
goto errout;
491-
rcu_assign_pointer(tp->root, head);
492-
}
493-
494494
f = kzalloc(sizeof(struct route4_filter), GFP_KERNEL);
495495
if (!f)
496496
goto errout;

0 commit comments

Comments
 (0)