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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210118203336.6e7170a1@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Mon, 18 Jan 2021 20:33:36 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     GR-Linux-NIC-Dev@...vell.com, davem@...emloft.net,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] net/qla3xxx: switch from 'pci_' to 'dma_' API

On Sun, 17 Jan 2021 09:15:42 +0100 Christophe JAILLET wrote:
> @@ -2525,9 +2519,8 @@ static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev)
>  	wmb();
>  
>  	qdev->req_q_virt_addr =
> -	    pci_alloc_consistent(qdev->pdev,
> -				 (size_t) qdev->req_q_size,
> -				 &qdev->req_q_phy_addr);
> +	    dma_alloc_coherent(&qdev->pdev->dev, (size_t)qdev->req_q_size,
> +			       &qdev->req_q_phy_addr, GFP_KERNEL);
>  
>  	if ((qdev->req_q_virt_addr == NULL) ||
>  	    LS_64BITS(qdev->req_q_phy_addr) & (qdev->req_q_size - 1)) {
> @@ -2536,16 +2529,14 @@ static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev)
>  	}
>  
>  	qdev->rsp_q_virt_addr =
> -	    pci_alloc_consistent(qdev->pdev,
> -				 (size_t) qdev->rsp_q_size,
> -				 &qdev->rsp_q_phy_addr);
> +	    dma_alloc_coherent(&qdev->pdev->dev, (size_t)qdev->rsp_q_size,
> +			       &qdev->rsp_q_phy_addr, GFP_KERNEL);
>  
>  	if ((qdev->rsp_q_virt_addr == NULL) ||
>  	    LS_64BITS(qdev->rsp_q_phy_addr) & (qdev->rsp_q_size - 1)) {
>  		netdev_err(qdev->ndev, "rspQ allocation failed\n");
> -		pci_free_consistent(qdev->pdev, (size_t) qdev->req_q_size,
> -				    qdev->req_q_virt_addr,
> -				    qdev->req_q_phy_addr);
> +		dma_free_coherent(&qdev->pdev->dev, (size_t)qdev->req_q_size,
> +				  qdev->req_q_virt_addr, qdev->req_q_phy_addr);
>  		return -ENOMEM;
>  	}

Something to follow up on - the error handling in this function looks
pretty sketchy. Looks like if the buffer was allocated but these
alignment conditions trigger the buffer is not freed. Happens both for
req and rsp buffer.

Applied, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ