Skip to contentSkip to conversation

net: sched: fix flush on non-existing chain

PATCH Applied Jiri Pirko 2 participants 2 messages Aug 3, 2018

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author maintainer
#0 lore raw

PATCH 1/1 net: sched: fix flush on non-existing chain

From: Jiri Pirko <[email protected]>

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.

Fixes f71e0ca4db18 ("net: sched: Avoid implicit chain 0 creation")
---
 net/sched/cls_api.c | 7 +++++++
 1 file changed, 7 insertions(+)
net/sched/cls_api.c +7 -0
index e8b0bbd0883f..194c2e0b2737 100644
@@ -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;
Signature · 1 line
2.14.4
maintainer Applied
#1 lore raw

From: Jiri Pirko <[email protected]>
Date: Fri, 3 Aug 2018 11:08:47 +0200

Quoted 11 lines

From: Jiri Pirko <[email protected]>

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.

Fixes f71e0ca4db18 ("net: sched: Avoid implicit chain 0 creation")

Applied.