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] [day] [month] [year] [list]
Message-ID: <20220715164417.577cbae3@kernel.org>
Date:   Fri, 15 Jul 2022 16:44:17 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Denis Kirjanov <kda@...ux-powerpc.org>
Cc:     netdev@...r.kernel.org
Subject: Re: [PATCH] net: altera: Handle dma_set_coherent_mask error codes

On Thu, 14 Jul 2022 16:23:42 +0300 Denis Kirjanov wrote:
> handle the error in the case that DMA mask is not supportyed
> 
> Fixes: bbd2190ce96d ("Altera TSE: Add main and header file for Altera Ethernet Driver")
> Signed-off-by: Denis Kirjanov <kda@...ux-powerpc.org>
> ---
>  drivers/net/ethernet/altera/altera_tse_main.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
> index 8c5828582c21..7773d978321a 100644
> --- a/drivers/net/ethernet/altera/altera_tse_main.c
> +++ b/drivers/net/ethernet/altera/altera_tse_main.c
> @@ -1439,10 +1439,14 @@ static int altera_tse_probe(struct platform_device *pdev)
>  	}
>  
>  	if (!dma_set_mask(priv->device, DMA_BIT_MASK(priv->dmaops->dmamask))) {
> -		dma_set_coherent_mask(priv->device,
> +		ret = dma_set_coherent_mask(priv->device,
>  				      DMA_BIT_MASK(priv->dmaops->dmamask));
> +		if (ret)
> +			goto err_free_netdev;
>  	} else if (!dma_set_mask(priv->device, DMA_BIT_MASK(32))) {
> -		dma_set_coherent_mask(priv->device, DMA_BIT_MASK(32));
> +		ret = dma_set_coherent_mask(priv->device, DMA_BIT_MASK(32));
> +		if (ret)
> +			goto err_free_netdev;
>  	} else {
>  		ret = -EIO;
>  		goto err_free_netdev;

Practically speaking this can't fail, see Christophe's patches like 
b6f2f0352c0302

If you want to be on the safe side just replace the dma_set_mask()
with dma_set_mask_and_coherent() and let the else branch handle the
failure.

Please CC maintainers when reposting.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ