diff options
author | Jiri Pirko <jiri@mellanox.com> | 2018-08-03 05:08:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-03 12:44:37 -0400 |
commit | 5ca8a25c144dbb04511147601943691baab0aaca (patch) | |
tree | fefa5952150439a38620e7d2a704dd31d2e8d81e /net/sched/cls_api.c | |
parent | 6fd544c897d98bc6f185da215f1585dc144218cc (diff) |
net: sched: fix flush on non-existing chain
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>
Diffstat (limited to 'net/sched/cls_api.c')
-rw-r--r-- | net/sched/cls_api.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index e8b0bbd0883f..194c2e0b2737 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -1389,6 +1389,13 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n, | |||
1389 | } | 1389 | } |
1390 | chain = tcf_chain_get(block, chain_index, false); | 1390 | chain = tcf_chain_get(block, chain_index, false); |
1391 | if (!chain) { | 1391 | if (!chain) { |
1392 | /* User requested flush on non-existent chain. Nothing to do, | ||
1393 | * so just return success. | ||
1394 | */ | ||
1395 | if (prio == 0) { | ||
1396 | err = 0; | ||
1397 | goto errout; | ||
1398 | } | ||
1392 | NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); | 1399 | NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); |
1393 | err = -EINVAL; | 1400 | err = -EINVAL; |
1394 | goto errout; | 1401 | goto errout; |