netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net] net_sched: fix a memory leak in tc action
@ 2016-04-04 17:32 Cong Wang
  2016-04-04 18:07 ` Eric Dumazet
  2016-04-06 20:04 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Cong Wang @ 2016-04-04 17:32 UTC (permalink / raw)
  To: netdev; +Cc: dvyukov, Cong Wang, Jamal Hadi Salim

Fixes: ddf97ccdd7cb ("net_sched: add network namespace support for tc actions")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 include/net/act_api.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/net/act_api.h b/include/net/act_api.h
index 2a19fe1..03e322b 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -135,6 +135,7 @@ void tcf_hashinfo_destroy(const struct tc_action_ops *ops,
 static inline void tc_action_net_exit(struct tc_action_net *tn)
 {
 	tcf_hashinfo_destroy(tn->ops, tn->hinfo);
+	kfree(tn->hinfo);
 }
 
 int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
-- 
2.1.0

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

* Re: [Patch net] net_sched: fix a memory leak in tc action
  2016-04-04 17:32 [Patch net] net_sched: fix a memory leak in tc action Cong Wang
@ 2016-04-04 18:07 ` Eric Dumazet
  2016-04-04 18:37   ` Cong Wang
  2016-04-06 20:04 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2016-04-04 18:07 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, dvyukov, Jamal Hadi Salim

On Mon, 2016-04-04 at 10:32 -0700, Cong Wang wrote:
> Fixes: ddf97ccdd7cb ("net_sched: add network namespace support for tc actions")
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
> Tested-by: Dmitry Vyukov <dvyukov@google.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
>  include/net/act_api.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/net/act_api.h b/include/net/act_api.h
> index 2a19fe1..03e322b 100644
> --- a/include/net/act_api.h
> +++ b/include/net/act_api.h
> @@ -135,6 +135,7 @@ void tcf_hashinfo_destroy(const struct tc_action_ops *ops,
>  static inline void tc_action_net_exit(struct tc_action_net *tn)
>  {
>  	tcf_hashinfo_destroy(tn->ops, tn->hinfo);
> +	kfree(tn->hinfo);
>  }
>  
>  int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,

Looks good to me, although the kfree() might be put in
cf_hashinfo_destroy() (at one place instead of being inlined in all call
points)

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

* Re: [Patch net] net_sched: fix a memory leak in tc action
  2016-04-04 18:07 ` Eric Dumazet
@ 2016-04-04 18:37   ` Cong Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Cong Wang @ 2016-04-04 18:37 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Linux Kernel Network Developers, Dmitry Vyukov, Jamal Hadi Salim

On Mon, Apr 4, 2016 at 11:07 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Mon, 2016-04-04 at 10:32 -0700, Cong Wang wrote:
>> Fixes: ddf97ccdd7cb ("net_sched: add network namespace support for tc actions")
>> Reported-by: Dmitry Vyukov <dvyukov@google.com>
>> Tested-by: Dmitry Vyukov <dvyukov@google.com>
>> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
>> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>> ---
>>  include/net/act_api.h | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/include/net/act_api.h b/include/net/act_api.h
>> index 2a19fe1..03e322b 100644
>> --- a/include/net/act_api.h
>> +++ b/include/net/act_api.h
>> @@ -135,6 +135,7 @@ void tcf_hashinfo_destroy(const struct tc_action_ops *ops,
>>  static inline void tc_action_net_exit(struct tc_action_net *tn)
>>  {
>>       tcf_hashinfo_destroy(tn->ops, tn->hinfo);
>> +     kfree(tn->hinfo);
>>  }
>>
>>  int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
>
> Looks good to me, although the kfree() might be put in
> cf_hashinfo_destroy() (at one place instead of being inlined in all call
> points)

Putting it in tc_action_net_exit() makes it symmetric with tc_action_net_init().

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

* Re: [Patch net] net_sched: fix a memory leak in tc action
  2016-04-04 17:32 [Patch net] net_sched: fix a memory leak in tc action Cong Wang
  2016-04-04 18:07 ` Eric Dumazet
@ 2016-04-06 20:04 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-04-06 20:04 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, dvyukov, jhs

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon,  4 Apr 2016 10:32:48 -0700

> Fixes: ddf97ccdd7cb ("net_sched: add network namespace support for tc actions")
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
> Tested-by: Dmitry Vyukov <dvyukov@google.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied, thanks Cong.

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

end of thread, other threads:[~2016-04-06 20:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-04 17:32 [Patch net] net_sched: fix a memory leak in tc action Cong Wang
2016-04-04 18:07 ` Eric Dumazet
2016-04-04 18:37   ` Cong Wang
2016-04-06 20:04 ` 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).