netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net] net_sched: remove cls_flower idr on failure
@ 2017-09-20 16:18 Cong Wang
  2017-09-20 16:40 ` Jiri Pirko
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Cong Wang @ 2017-09-20 16:18 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang, Chris Mi, Jiri Pirko

Fixes: c15ab236d69d ("net/sched: Change cls_flower to use IDR")
Cc: Chris Mi <chrism@mellanox.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 net/sched/cls_flower.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 1a267e77c6de..d230cb4c8094 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -922,28 +922,28 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
 
 		if (!tc_flags_valid(fnew->flags)) {
 			err = -EINVAL;
-			goto errout;
+			goto errout_idr;
 		}
 	}
 
 	err = fl_set_parms(net, tp, fnew, &mask, base, tb, tca[TCA_RATE], ovr);
 	if (err)
-		goto errout;
+		goto errout_idr;
 
 	err = fl_check_assign_mask(head, &mask);
 	if (err)
-		goto errout;
+		goto errout_idr;
 
 	if (!tc_skip_sw(fnew->flags)) {
 		if (!fold && fl_lookup(head, &fnew->mkey)) {
 			err = -EEXIST;
-			goto errout;
+			goto errout_idr;
 		}
 
 		err = rhashtable_insert_fast(&head->ht, &fnew->ht_node,
 					     head->ht_params);
 		if (err)
-			goto errout;
+			goto errout_idr;
 	}
 
 	if (!tc_skip_hw(fnew->flags)) {
@@ -952,7 +952,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
 					   &mask.key,
 					   fnew);
 		if (err)
-			goto errout;
+			goto errout_idr;
 	}
 
 	if (!tc_in_hw(fnew->flags))
@@ -981,6 +981,9 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
 	kfree(tb);
 	return 0;
 
+errout_idr:
+	if (fnew->handle)
+		idr_remove_ext(&head->handle_idr, fnew->handle);
 errout:
 	tcf_exts_destroy(&fnew->exts);
 	kfree(fnew);
-- 
2.13.0

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

* Re: [Patch net] net_sched: remove cls_flower idr on failure
  2017-09-20 16:18 [Patch net] net_sched: remove cls_flower idr on failure Cong Wang
@ 2017-09-20 16:40 ` Jiri Pirko
  2017-09-21 18:47 ` Cong Wang
  2017-09-21 22:14 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Jiri Pirko @ 2017-09-20 16:40 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, Chris Mi, Jiri Pirko

Wed, Sep 20, 2017 at 06:18:45PM CEST, xiyou.wangcong@gmail.com wrote:
>Fixes: c15ab236d69d ("net/sched: Change cls_flower to use IDR")
>Cc: Chris Mi <chrism@mellanox.com>
>Cc: Jiri Pirko <jiri@mellanox.com>
>Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Looks fine.
Acked-by: Jiri Pirko <jiri@mellanox.com>

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

* Re: [Patch net] net_sched: remove cls_flower idr on failure
  2017-09-20 16:18 [Patch net] net_sched: remove cls_flower idr on failure Cong Wang
  2017-09-20 16:40 ` Jiri Pirko
@ 2017-09-21 18:47 ` Cong Wang
  2017-09-21 18:50   ` Cong Wang
  2017-09-21 22:14 ` David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: Cong Wang @ 2017-09-21 18:47 UTC (permalink / raw)
  To: Linux Kernel Network Developers; +Cc: Cong Wang, Chris Mi, Jiri Pirko

On Wed, Sep 20, 2017 at 9:18 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> +errout_idr:
> +       if (fnew->handle)
> +               idr_remove_ext(&head->handle_idr, fnew->handle);

Hmm, I should check fold instead of fnew->handle here.
I will update this patch.

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

* Re: [Patch net] net_sched: remove cls_flower idr on failure
  2017-09-21 18:47 ` Cong Wang
@ 2017-09-21 18:50   ` Cong Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2017-09-21 18:50 UTC (permalink / raw)
  To: Linux Kernel Network Developers; +Cc: Cong Wang, Chris Mi, Jiri Pirko

On Thu, Sep 21, 2017 at 11:47 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> On Wed, Sep 20, 2017 at 9:18 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> +errout_idr:
>> +       if (fnew->handle)
>> +               idr_remove_ext(&head->handle_idr, fnew->handle);
>
> Hmm, I should check fold instead of fnew->handle here.
> I will update this patch.

Never mind, it should be the same logic. If fold is non-NULL,
then fnew->handle == 0.

It can be applied as it is.

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

* Re: [Patch net] net_sched: remove cls_flower idr on failure
  2017-09-20 16:18 [Patch net] net_sched: remove cls_flower idr on failure Cong Wang
  2017-09-20 16:40 ` Jiri Pirko
  2017-09-21 18:47 ` Cong Wang
@ 2017-09-21 22:14 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-09-21 22:14 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, chrism, jiri

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Wed, 20 Sep 2017 09:18:45 -0700

> Fixes: c15ab236d69d ("net/sched: Change cls_flower to use IDR")
> Cc: Chris Mi <chrism@mellanox.com>
> Cc: Jiri Pirko <jiri@mellanox.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied, thanks.

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

end of thread, other threads:[~2017-09-21 22:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20 16:18 [Patch net] net_sched: remove cls_flower idr on failure Cong Wang
2017-09-20 16:40 ` Jiri Pirko
2017-09-21 18:47 ` Cong Wang
2017-09-21 18:50   ` Cong Wang
2017-09-21 22:14 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).