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]
Date:   Tue, 30 Oct 2018 18:17:46 +0800
From:   tanhuazhong <tanhuazhong@...wei.com>
To:     Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
        <davem@...emloft.net>
CC:     <netdev@...r.kernel.org>, <linuxarm@...wei.com>,
        <salil.mehta@...wei.com>, <yisen.zhuang@...wei.com>,
        <lipeng321@...wei.com>, <linyunsheng@...wei.com>
Subject: Re: [Patch V4 net 02/11] net: hns3: add error handler for
 hns3_get_ring_config/hns3_queue_to_ring



On 2018/10/30 17:09, Sergei Shtylyov wrote:
> Hello!
> 
> On 10/29/2018 4:54 PM, Huazhong Tan wrote:
> 
>> When hns3_get_ring_config()/hns3_queue_to_ring() failed during resetting,
>> the allocated memory has not been freed before hns3_get_ring_config() and
>> hns3_queue_to_ring() return. So this patch fixes the buffer not freeing
>> problem during resetting.
>>
>> Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver 
>> for hip08 SoC")
>> Signed-off-by: Huazhong Tan <tanhuazhong@...wei.com>
>> ---
>>   drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 12 ++++++++++--
>>   1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c 
>> b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> index d9066c5..6f0fd62 100644
>> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
> [...]
>> @@ -3047,7 +3049,7 @@ static int hns3_get_ring_config(struct 
>> hns3_nic_priv *priv)
>>   {
>>       struct hnae3_handle *h = priv->ae_handle;
>>       struct pci_dev *pdev = h->pdev;
>> -    int i, ret;
>> +    int i, j, ret;
>>       priv->ring_data =  devm_kzalloc(&pdev->dev,
>>                       array3_size(h->kinfo.num_tqps,
>> @@ -3065,6 +3067,12 @@ static int hns3_get_ring_config(struct 
>> hns3_nic_priv *priv)
>>       return 0;
>>   err:
>> +    for (j = i - 1; j >= 0; j--) {
> 
>     As is with the other patch, you don't need 'j' here.
> 

Yes, i have modified it.
Thanks.

>> +        devm_kfree(priv->dev, priv->ring_data[j].ring);
>> +        devm_kfree(priv->dev,
>> +               priv->ring_data[j + h->kinfo.num_tqps].ring);
>> +    }
>> +
>>       devm_kfree(&pdev->dev, priv->ring_data);
>>       return ret;
>>   }
> 
> MBR, Sergei
> 

Greeting.
Huazhong.

> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ