From: Jiri Pirko Date: Tue, 2 Dec 2014 17:00:32 +0000 (+0100) Subject: net_sched: cls_bpf: remove unnecessary iteration and use passed arg X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=472f58370128d5e18f9d5429313a87d0f30af45e;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git net_sched: cls_bpf: remove unnecessary iteration and use passed arg Signed-off-by: Jiri Pirko Acked-by: Jamal Hadi Salim Acked-by: Daniel Borkmann Signed-off-by: David S. Miller --- diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index eed49d1d0878..cbfaf6f8feb3 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c @@ -109,19 +109,12 @@ static void __cls_bpf_delete_prog(struct rcu_head *rcu) static int cls_bpf_delete(struct tcf_proto *tp, unsigned long arg) { - struct cls_bpf_head *head = rtnl_dereference(tp->root); - struct cls_bpf_prog *prog, *todel = (struct cls_bpf_prog *) arg; - - list_for_each_entry(prog, &head->plist, link) { - if (prog == todel) { - list_del_rcu(&prog->link); - tcf_unbind_filter(tp, &prog->res); - call_rcu(&prog->rcu, __cls_bpf_delete_prog); - return 0; - } - } + struct cls_bpf_prog *prog = (struct cls_bpf_prog *) arg; - return -ENOENT; + list_del_rcu(&prog->link); + tcf_unbind_filter(tp, &prog->res); + call_rcu(&prog->rcu, __cls_bpf_delete_prog); + return 0; } static void cls_bpf_destroy(struct tcf_proto *tp)