Commit 43920538 authored by WANG Cong's avatar WANG Cong Committed by David S. Miller

net_sched: remove useless NULL to tp->root

There is no need to NULL tp->root in ->destroy(), since tp is
going to be freed very soon, and existing readers are still
safe to read them.

For cls_route, we always init its tp->root, so it can't be NULL,
we can drop more useless code.

Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 763dbf63
...@@ -144,7 +144,6 @@ static void fw_destroy(struct tcf_proto *tp) ...@@ -144,7 +144,6 @@ static void fw_destroy(struct tcf_proto *tp)
call_rcu(&f->rcu, fw_delete_filter); call_rcu(&f->rcu, fw_delete_filter);
} }
} }
RCU_INIT_POINTER(tp->root, NULL);
kfree_rcu(head, rcu); kfree_rcu(head, rcu);
} }
......
...@@ -140,8 +140,6 @@ static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp, ...@@ -140,8 +140,6 @@ static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp,
goto failure; goto failure;
id = dst->tclassid; id = dst->tclassid;
if (head == NULL)
goto old_method;
iif = inet_iif(skb); iif = inet_iif(skb);
...@@ -194,15 +192,6 @@ static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp, ...@@ -194,15 +192,6 @@ static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp,
route4_set_fastmap(head, id, iif, ROUTE4_FAILURE); route4_set_fastmap(head, id, iif, ROUTE4_FAILURE);
failure: failure:
return -1; return -1;
old_method:
if (id && (TC_H_MAJ(id) == 0 ||
!(TC_H_MAJ(id^tp->q->handle)))) {
res->classid = id;
res->class = 0;
return 0;
}
return -1;
} }
static inline u32 to_hash(u32 id) static inline u32 to_hash(u32 id)
...@@ -234,9 +223,6 @@ static unsigned long route4_get(struct tcf_proto *tp, u32 handle) ...@@ -234,9 +223,6 @@ static unsigned long route4_get(struct tcf_proto *tp, u32 handle)
struct route4_filter *f; struct route4_filter *f;
unsigned int h1, h2; unsigned int h1, h2;
if (!head)
return 0;
h1 = to_hash(handle); h1 = to_hash(handle);
if (h1 > 256) if (h1 > 256)
return 0; return 0;
...@@ -305,7 +291,6 @@ static void route4_destroy(struct tcf_proto *tp) ...@@ -305,7 +291,6 @@ static void route4_destroy(struct tcf_proto *tp)
kfree_rcu(b, rcu); kfree_rcu(b, rcu);
} }
} }
RCU_INIT_POINTER(tp->root, NULL);
kfree_rcu(head, rcu); kfree_rcu(head, rcu);
} }
......
...@@ -152,8 +152,6 @@ static int rsvp_classify(struct sk_buff *skb, const struct tcf_proto *tp, ...@@ -152,8 +152,6 @@ static int rsvp_classify(struct sk_buff *skb, const struct tcf_proto *tp,
return -1; return -1;
nhptr = ip_hdr(skb); nhptr = ip_hdr(skb);
#endif #endif
if (unlikely(!head))
return -1;
restart: restart:
#if RSVP_DST_LEN == 4 #if RSVP_DST_LEN == 4
...@@ -310,8 +308,6 @@ static void rsvp_destroy(struct tcf_proto *tp) ...@@ -310,8 +308,6 @@ static void rsvp_destroy(struct tcf_proto *tp)
if (data == NULL) if (data == NULL)
return; return;
RCU_INIT_POINTER(tp->root, NULL);
for (h1 = 0; h1 < 256; h1++) { for (h1 = 0; h1 < 256; h1++) {
struct rsvp_session *s; struct rsvp_session *s;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment