lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1382607218.7572.45.camel@edumazet-glaptop.roam.corp.google.com>
Date:	Thu, 24 Oct 2013 02:33:38 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Jing Wang <windsdaemon@...il.com>
Cc:	davem@...emloft.net, jhs@...atatu.com, netdev@...r.kernel.org
Subject: Re: [PATCH 1/1] net:sched  fix a bug about memery leak

On Thu, 2013-10-24 at 17:12 +0800, Jing Wang wrote:
> From: Jing Wang <windsdaemon@...il.com>
> 
> the code isn't properly release memory
> 
> Signed-off-by: Jing Wang <windsdaemon@...il.com>
> ---
>  net/sched/cls_route.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
> index 37da567..118f8d5 100644
> --- a/net/sched/cls_route.c
> +++ b/net/sched/cls_route.c
> @@ -466,11 +466,11 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
>  		goto reinsert;
>  	}
>  
> -	err = -ENOBUFS;
> +	err = -ENOMEM;
>  	if (head == NULL) {
>  		head = kzalloc(sizeof(struct route4_head), GFP_KERNEL);
>  		if (head == NULL)
> -			goto errout;
> +			goto errhead;
>  
>  		tcf_tree_lock(tp);
>  		tp->root = head;
> @@ -479,7 +479,7 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
>  
>  	f = kzalloc(sizeof(struct route4_filter), GFP_KERNEL);
>  	if (f == NULL)
> -		goto errout;
> +		goto errflt;
>  
>  	err = route4_set_parms(net, tp, base, f, handle, head, tb,
>  		tca[TCA_RATE], 1);
> @@ -517,6 +517,9 @@ reinsert:
>  
>  errout:
>  	kfree(f);
> +errflt:
> +    kfree(head);
> +errhead:
>  	return err;
>  }
>  

I don't think this patch is needed or correct.

tp->root is the head, you cannot free it like that.

It will be freed properly in route4_destroy()

Please elaborate, thanks.



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ