net_sched: fix a missing idr_remove() in u32_delete_key()
authorCong Wang <xiyou.wangcong@gmail.com>
Sat, 7 Apr 2018 00:19:41 +0000 (17:19 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Apr 2018 16:36:45 +0000 (12:36 -0400)
When we delete a u32 key via u32_delete_key(), we forget to
call idr_remove() to remove its handle from IDR.

Fixes: e7614370d6f0 ("net_sched: use idr to allocate u32 filter handles")
Reported-by: Marcin Kabiesz <admin@hostcenter.eu>
Tested-by: Marcin Kabiesz <admin@hostcenter.eu>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_u32.c

index ed8b6a24b9e9325cc99f17e6ed00ead73fe0171e..bac47b5d18fdbd6bca9e3a39822db67be946b21b 100644 (file)
@@ -489,6 +489,7 @@ static int u32_delete_key(struct tcf_proto *tp, struct tc_u_knode *key)
                                RCU_INIT_POINTER(*kp, key->next);
 
                                tcf_unbind_filter(tp, &key->res);
+                               idr_remove(&ht->handle_idr, key->handle);
                                tcf_exts_get_net(&key->exts);
                                call_rcu(&key->rcu, u32_delete_key_freepf_rcu);
                                return 0;