diff options
-rw-r--r-- | net/sched/cls_bpf.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index 243c9f225a73..5c4171c5d2bd 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
@@ -64,8 +64,10 @@ static int cls_bpf_classify(struct sk_buff *skb, const struct tcf_proto *tp, | |||
64 | { | 64 | { |
65 | struct cls_bpf_head *head = rcu_dereference_bh(tp->root); | 65 | struct cls_bpf_head *head = rcu_dereference_bh(tp->root); |
66 | struct cls_bpf_prog *prog; | 66 | struct cls_bpf_prog *prog; |
67 | int ret; | 67 | int ret = -1; |
68 | 68 | ||
69 | /* Needed here for accessing maps. */ | ||
70 | rcu_read_lock(); | ||
69 | list_for_each_entry_rcu(prog, &head->plist, link) { | 71 | list_for_each_entry_rcu(prog, &head->plist, link) { |
70 | int filter_res = BPF_PROG_RUN(prog->filter, skb); | 72 | int filter_res = BPF_PROG_RUN(prog->filter, skb); |
71 | 73 | ||
@@ -80,10 +82,11 @@ static int cls_bpf_classify(struct sk_buff *skb, const struct tcf_proto *tp, | |||
80 | if (ret < 0) | 82 | if (ret < 0) |
81 | continue; | 83 | continue; |
82 | 84 | ||
83 | return ret; | 85 | break; |
84 | } | 86 | } |
87 | rcu_read_unlock(); | ||
85 | 88 | ||
86 | return -1; | 89 | return ret; |
87 | } | 90 | } |
88 | 91 | ||
89 | static bool cls_bpf_is_ebpf(const struct cls_bpf_prog *prog) | 92 | static bool cls_bpf_is_ebpf(const struct cls_bpf_prog *prog) |