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: <20200422173425.1a46db2c@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Wed, 22 Apr 2020 17:34:25 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     <sameehj@...zon.com>
Cc:     <davem@...emloft.net>, <netdev@...r.kernel.org>,
        Arthur Kiyanovski <akiyano@...zon.com>, <dwmw@...zon.com>,
        <zorik@...zon.com>, <matua@...zon.com>, <saeedb@...zon.com>,
        <msw@...zon.com>, <aliguori@...zon.com>, <nafea@...zon.com>,
        <gtzalik@...zon.com>, <netanel@...zon.com>, <alisaidi@...zon.com>,
        <benh@...zon.com>, <ndagan@...zon.com>
Subject: Re: [PATCH V1 net-next 01/13] net: ena: fix error returning in
 ena_com_get_hash_function()

On Wed, 22 Apr 2020 08:16:16 +0000 sameehj@...zon.com wrote:
> From: Arthur Kiyanovski <akiyano@...zon.com>
> 
> In case the "func" parameter is NULL we now return "-EINVAL".
> This shouldn't happen in general, but when it does happen, this is the
> proper way to handle it.
> 
> We also check func for NULL in the beginning of the function, as there
> is no reason to do all the work and realize in the end of the function
> it was useless.
> 
> Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
> Signed-off-by: Sameeh Jubran <sameehj@...zon.com>
> Signed-off-by: Arthur Kiyanovski <akiyano@...zon.com>
> ---
>  drivers/net/ethernet/amazon/ena/ena_com.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
> index a250046b8e18..07b0f396d3c2 100644
> --- a/drivers/net/ethernet/amazon/ena/ena_com.c
> +++ b/drivers/net/ethernet/amazon/ena/ena_com.c
> @@ -2345,6 +2345,9 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev,
>  		rss->hash_key;
>  	int rc;
>
> +	if (unlikely(!func))
> +		return -EINVAL;
> +

There is a call to this with func being null like 5 lines above:

	/* Restore the old function */
	if (unlikely(rc))
		ena_com_get_hash_function(ena_dev, NULL, NULL);

What am I missing?


>  	rc = ena_com_get_feature_ex(ena_dev, &get_resp,
>  				    ENA_ADMIN_RSS_HASH_FUNCTION,
>  				    rss->hash_key_dma_addr,
> @@ -2357,8 +2360,7 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev,
>  	if (rss->hash_func)
>  		rss->hash_func--;
>  
> -	if (func)
> -		*func = rss->hash_func;
> +	*func = rss->hash_func;
>  
>  	if (key)
>  		memcpy(key, hash_key->key, (size_t)(hash_key->keys_num) << 2);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ