All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch net-next] net: sched: fix flush on non-existing chain
@ 2018-08-03  9:08 Jiri Pirko
  2018-08-03 16:45 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Pirko @ 2018-08-03  9:08 UTC (permalink / raw)
  To: netdev; +Cc: davem, jhs, xiyou.wangcong, jakub.kicinski, idosch, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

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>
---
 net/sched/cls_api.c | 7 +++++++
 1 file changed, 7 insertions(+)

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,
 	}
 	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;
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch net-next] net: sched: fix flush on non-existing chain
  2018-08-03  9:08 [patch net-next] net: sched: fix flush on non-existing chain Jiri Pirko
@ 2018-08-03 16:45 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-08-03 16:45 UTC (permalink / raw)
  To: jiri; +Cc: netdev, jhs, xiyou.wangcong, jakub.kicinski, idosch, mlxsw

From: Jiri Pirko <jiri@resnulli.us>
Date: Fri,  3 Aug 2018 11:08:47 +0200

> From: Jiri Pirko <jiri@mellanox.com>
> 
> 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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-03 18:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-03  9:08 [patch net-next] net: sched: fix flush on non-existing chain Jiri Pirko
2018-08-03 16:45 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.