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: <febd4aab-8a09-e4c5-37db-2d7ef6cbe864@amazon.com>
Date:   Fri, 8 Jun 2018 12:46:14 +0300
From:   Gal Pressman <galpress@...zon.com>
To:     Ivan Vecera <cera@...a.cz>, <linville@...driver.com>
CC:     <netdev@...r.kernel.org>, Gal Pressman <galp@...lanox.com>
Subject: Re: [PATCH ethtool 5/6] ethtool: correctly free hkey when
 get_stringset() fails

On 08-Jun-18 12:20, Ivan Vecera wrote:
> Memory allocated for 'hkey' is not freed when
> get_stringset(..., ETH_SS_RSS_HASH_FUNCS...) fails.
> 
> Fixes: b888f35 ("ethtool: Support for configurable RSS hash function")

Thanks for fixing this!
Please use the first 12 characters of the sha1 in the Fixes line.

> Cc: Gal Pressman <galp@...lanox.com>
> Signed-off-by: Ivan Vecera <cera@...a.cz>
> ---
>  ethtool.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/ethtool.c b/ethtool.c
> index 2b90984..fb93ae8 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -3910,7 +3910,7 @@ static int do_srxfhindir(struct cmd_context *ctx, int rxfhindir_default,
>  static int do_srxfh(struct cmd_context *ctx)
>  {
>  	struct ethtool_rxfh rss_head = {0};
> -	struct ethtool_rxfh *rss;
> +	struct ethtool_rxfh *rss = NULL;
>  	struct ethtool_rxnfc ring_count;
>  	int rxfhindir_equal = 0, rxfhindir_default = 0;
>  	struct ethtool_gstrings *hfuncs = NULL;
> @@ -4064,7 +4064,8 @@ static int do_srxfh(struct cmd_context *ctx)
>  		hfuncs = get_stringset(ctx, ETH_SS_RSS_HASH_FUNCS, 0, 1);
>  		if (!hfuncs) {
>  			perror("Cannot get hash functions names");
> -			return 1;
> +			err = 1;
> +			goto free;
>  		}
>  
>  		for (i = 0; i < hfuncs->len && !req_hfunc ; i++) {
> @@ -4078,8 +4079,8 @@ static int do_srxfh(struct cmd_context *ctx)
>  		if (!req_hfunc) {
>  			fprintf(stderr,
>  				"Unknown hash function: %s\n", req_hfunc_name);
> -			free(hfuncs);
> -			return 1;
> +			err = 1;
> +			goto free;
>  		}
>  	}
>  
> @@ -4120,9 +4121,7 @@ static int do_srxfh(struct cmd_context *ctx)
>  	}
>  
>  free:
> -	if (hkey)
> -		free(hkey);
> -
> +	free(hkey);
>  	free(rss);
>  	free(hfuncs);
>  	return err;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ