diff options
Diffstat (limited to 'net/sched/cls_bpf.c')
-rw-r--r-- | net/sched/cls_bpf.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index 6f7ed8f8e6ee..243c9f225a73 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
@@ -137,11 +137,14 @@ static int cls_bpf_delete(struct tcf_proto *tp, unsigned long arg) | |||
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
139 | 139 | ||
140 | static void cls_bpf_destroy(struct tcf_proto *tp) | 140 | static bool cls_bpf_destroy(struct tcf_proto *tp, bool force) |
141 | { | 141 | { |
142 | struct cls_bpf_head *head = rtnl_dereference(tp->root); | 142 | struct cls_bpf_head *head = rtnl_dereference(tp->root); |
143 | struct cls_bpf_prog *prog, *tmp; | 143 | struct cls_bpf_prog *prog, *tmp; |
144 | 144 | ||
145 | if (!force && !list_empty(&head->plist)) | ||
146 | return false; | ||
147 | |||
145 | list_for_each_entry_safe(prog, tmp, &head->plist, link) { | 148 | list_for_each_entry_safe(prog, tmp, &head->plist, link) { |
146 | list_del_rcu(&prog->link); | 149 | list_del_rcu(&prog->link); |
147 | tcf_unbind_filter(tp, &prog->res); | 150 | tcf_unbind_filter(tp, &prog->res); |
@@ -150,6 +153,7 @@ static void cls_bpf_destroy(struct tcf_proto *tp) | |||
150 | 153 | ||
151 | RCU_INIT_POINTER(tp->root, NULL); | 154 | RCU_INIT_POINTER(tp->root, NULL); |
152 | kfree_rcu(head, rcu); | 155 | kfree_rcu(head, rcu); |
156 | return true; | ||
153 | } | 157 | } |
154 | 158 | ||
155 | static unsigned long cls_bpf_get(struct tcf_proto *tp, u32 handle) | 159 | static unsigned long cls_bpf_get(struct tcf_proto *tp, u32 handle) |