]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: sched: fix flush on non-existing chain
authorJiri Pirko <jiri@mellanox.com>
Fri, 3 Aug 2018 09:08:47 +0000 (11:08 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Aug 2018 16:44:37 +0000 (09:44 -0700)
User was able to perform filter flush on chain 0 even if it didn't have
any filters in it. With the patch that avoided implicit chain 0
creation, this changed. So in case user wants filter flush on chain
which does not exist, just return success. There's no reason for non-0
chains to behave differently than chain 0, so do the same for them.

Reported-by: Ido Schimmel <idosch@mellanox.com>
Fixes: f71e0ca4db18 ("net: sched: Avoid implicit chain 0 creation")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_api.c

index e8b0bbd0883f3b427f9ff406346d504d545c60a3..194c2e0b27372878448979bfdeee3fadb932cd52 100644 (file)
@@ -1389,6 +1389,13 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
        }
        chain = tcf_chain_get(block, chain_index, false);
        if (!chain) {
+               /* User requested flush on non-existent chain. Nothing to do,
+                * so just return success.
+                */
+               if (prio == 0) {
+                       err = 0;
+                       goto errout;
+               }
                NL_SET_ERR_MSG(extack, "Cannot find specified filter chain");
                err = -EINVAL;
                goto errout;