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] [thread-next>] [day] [month] [year] [list]
Message-ID: <f29e851d-c4d7-cd04-dbb7-582adebc2854@mellanox.com>
Date:   Thu, 10 May 2018 17:36:55 +0300
From:   Tariq Toukan <tariqt@...lanox.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>,
        Yuval Shaia <yuval.shaia@...cle.com>
Cc:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        davem@...emloft.net, tariqt@...lanox.com, netdev@...r.kernel.org,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] net/mlx4_en: Fix an error handling path in
 'mlx4_en_init_netdev()'



On 10/05/2018 5:18 PM, Dan Carpenter wrote:
> On Thu, May 10, 2018 at 04:38:08PM +0300, Yuval Shaia wrote:
>> On Thu, May 10, 2018 at 09:02:26AM +0200, Christophe JAILLET wrote:
>>> If an error occurs, 'mlx4_en_destroy_netdev()' is called.
>>> It then calls 'mlx4_en_free_resources()' which does the needed resources
>>> cleanup.
>>>
>>> So, doing some explicit kfree in the error handling path would lead to
>>> some double kfree.
>>
>> Patch make sense but what's bothering me is that mlx4_en_free_resources
>> loops on the entire array, assuming !priv->tx_ring[t] means entry is
>> allocated but the existing code does not assume that, see [1]. So i looked
>> to see where tx_ring array is zeroed and didn't find it.
>>
>> Am i missing something here.
>>
> 
> It's zeroed twice.  alloc_etherdev_mqs() allocates zeroed memory and
> then we do a memset(priv, 0, sizeof(struct mlx4_en_priv));
> 
> regards,
> dan carpenter
> 

We do zero (twice) on init, that's right. But I think Yuval's comment is 
valid in case of the driver went into configuration change, or down/up, 
that reallocates the rings. I'm double checking this.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ