These changes are a raw update to a vanilla kernel 4.1.10, with the
[kvmfornfv.git] / kernel / net / sched / cls_u32.c
index cab9e9b..4fbb674 100644 (file)
@@ -490,6 +490,19 @@ static bool u32_destroy(struct tcf_proto *tp, bool force)
                                        return false;
                        }
                }
+
+               if (tp_c->refcnt > 1)
+                       return false;
+
+               if (tp_c->refcnt == 1) {
+                       struct tc_u_hnode *ht;
+
+                       for (ht = rtnl_dereference(tp_c->hlist);
+                            ht;
+                            ht = rtnl_dereference(ht->next))
+                               if (!ht_empty(ht))
+                                       return false;
+               }
        }
 
        if (root_ht && --root_ht->refcnt == 0)