Commit a05c2d112c0c4a768bfad47c33f28a15f8cf1193

Authored by WANG Cong
Committed by David S. Miller
1 parent 2490c65fe8

net_sched: move tp->root allocation into route4_init()

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

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

net/sched/cls_route.c
... ... @@ -258,6 +258,13 @@
258 258  
259 259 static int route4_init(struct tcf_proto *tp)
260 260 {
  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);
261 268 return 0;
262 269 }
263 270  
... ... @@ -484,13 +491,6 @@
484 491 return -EINVAL;
485 492  
486 493 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   -
494 494 f = kzalloc(sizeof(struct route4_filter), GFP_KERNEL);
495 495 if (!f)
496 496 goto errout;