netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net/sched: act_sample: Little fixes
@ 2017-01-31  9:33 Yotam Gigi
  2017-01-31  9:33 ` [PATCH net-next 1/2] net/sched: act_sample: Fix error path in init Yotam Gigi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Yotam Gigi @ 2017-01-31  9:33 UTC (permalink / raw)
  To: davem, jhs, netdev, jiri, eladr; +Cc: Yotam Gigi

Little fixes in sample tc action.

Yotam Gigi (2):
  net/sched: act_sample: Fix error path in init
  net/sched: act_psample: Remove unnecessary ASSERT_RTNL

 net/sched/act_sample.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

-- 
2.4.11

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

* [PATCH net-next 1/2] net/sched: act_sample: Fix error path in init
  2017-01-31  9:33 [PATCH net-next 0/2] net/sched: act_sample: Little fixes Yotam Gigi
@ 2017-01-31  9:33 ` Yotam Gigi
  2017-01-31  9:33 ` [PATCH net-next 2/2] net/sched: act_psample: Remove unnecessary ASSERT_RTNL Yotam Gigi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Yotam Gigi @ 2017-01-31  9:33 UTC (permalink / raw)
  To: davem, jhs, netdev, jiri, eladr; +Cc: Yotam Gigi

Fix error path of in sample init, by releasing the tc hash in case of
failure in psample_group creation.

Fixes: 5c5670fae430 ("net/sched: Introduce sample tc action")
Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
---
 net/sched/act_sample.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 3922975..02b6749 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -81,8 +81,11 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
 	s->rate = nla_get_u32(tb[TCA_SAMPLE_RATE]);
 	s->psample_group_num = nla_get_u32(tb[TCA_SAMPLE_PSAMPLE_GROUP]);
 	psample_group = psample_group_get(net, s->psample_group_num);
-	if (!psample_group)
+	if (!psample_group) {
+		if (ret == ACT_P_CREATED)
+			tcf_hash_release(*a, bind);
 		return -ENOMEM;
+	}
 	RCU_INIT_POINTER(s->psample_group, psample_group);
 
 	if (tb[TCA_SAMPLE_TRUNC_SIZE]) {
-- 
2.4.11

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

* [PATCH net-next 2/2] net/sched: act_psample: Remove unnecessary ASSERT_RTNL
  2017-01-31  9:33 [PATCH net-next 0/2] net/sched: act_sample: Little fixes Yotam Gigi
  2017-01-31  9:33 ` [PATCH net-next 1/2] net/sched: act_sample: Fix error path in init Yotam Gigi
@ 2017-01-31  9:33 ` Yotam Gigi
  2017-02-01 17:14 ` [PATCH net-next 0/2] net/sched: act_sample: Little fixes Cong Wang
  2017-02-01 19:10 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Yotam Gigi @ 2017-01-31  9:33 UTC (permalink / raw)
  To: davem, jhs, netdev, jiri, eladr; +Cc: Yotam Gigi

The ASSERT_RTNL is not necessary in the init function, as it does not
touch any rtnl protected structures, as opposed to the mirred action which
does have to hold a net device.

Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
---
 net/sched/act_sample.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 02b6749..0b8217b 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -76,7 +76,6 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
 	}
 	s = to_sample(*a);
 
-	ASSERT_RTNL();
 	s->tcf_action = parm->action;
 	s->rate = nla_get_u32(tb[TCA_SAMPLE_RATE]);
 	s->psample_group_num = nla_get_u32(tb[TCA_SAMPLE_PSAMPLE_GROUP]);
-- 
2.4.11

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

* Re: [PATCH net-next 0/2] net/sched: act_sample: Little fixes
  2017-01-31  9:33 [PATCH net-next 0/2] net/sched: act_sample: Little fixes Yotam Gigi
  2017-01-31  9:33 ` [PATCH net-next 1/2] net/sched: act_sample: Fix error path in init Yotam Gigi
  2017-01-31  9:33 ` [PATCH net-next 2/2] net/sched: act_psample: Remove unnecessary ASSERT_RTNL Yotam Gigi
@ 2017-02-01 17:14 ` Cong Wang
  2017-02-01 19:10 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2017-02-01 17:14 UTC (permalink / raw)
  To: Yotam Gigi
  Cc: David Miller, Jamal Hadi Salim, Linux Kernel Network Developers,
	Jiri Pirko, Elad Raz

On Tue, Jan 31, 2017 at 1:33 AM, Yotam Gigi <yotamg@mellanox.com> wrote:
> Little fixes in sample tc action.
>
> Yotam Gigi (2):
>   net/sched: act_sample: Fix error path in init
>   net/sched: act_psample: Remove unnecessary ASSERT_RTNL
>

Acked-by: Cong Wang <xiyou.wangcong@gmail.com>

Thanks!

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

* Re: [PATCH net-next 0/2] net/sched: act_sample: Little fixes
  2017-01-31  9:33 [PATCH net-next 0/2] net/sched: act_sample: Little fixes Yotam Gigi
                   ` (2 preceding siblings ...)
  2017-02-01 17:14 ` [PATCH net-next 0/2] net/sched: act_sample: Little fixes Cong Wang
@ 2017-02-01 19:10 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-02-01 19:10 UTC (permalink / raw)
  To: yotamg; +Cc: jhs, netdev, jiri, eladr

From: Yotam Gigi <yotamg@mellanox.com>
Date: Tue, 31 Jan 2017 11:33:52 +0200

> Little fixes in sample tc action.

Series applied, thanks.

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

end of thread, other threads:[~2017-02-01 19:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-31  9:33 [PATCH net-next 0/2] net/sched: act_sample: Little fixes Yotam Gigi
2017-01-31  9:33 ` [PATCH net-next 1/2] net/sched: act_sample: Fix error path in init Yotam Gigi
2017-01-31  9:33 ` [PATCH net-next 2/2] net/sched: act_psample: Remove unnecessary ASSERT_RTNL Yotam Gigi
2017-02-01 17:14 ` [PATCH net-next 0/2] net/sched: act_sample: Little fixes Cong Wang
2017-02-01 19:10 ` 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).