From: Tariq Toukan <tariqt@mellanox.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Yuval Shaia <yuval.shaia@oracle.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
davem@davemloft.net, netdev@vger.kernel.org,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] net/mlx4_en: Fix an error handling path in 'mlx4_en_init_netdev()'
Date: Thu, 10 May 2018 18:03:36 +0300 [thread overview]
Message-ID: <49d89081-95d8-e7ae-2903-372a201ff92c@mellanox.com> (raw)
In-Reply-To: <f29e851d-c4d7-cd04-dbb7-582adebc2854@mellanox.com>
On 10/05/2018 5:36 PM, Tariq Toukan wrote:
>
>
> 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.
Well, the flows in which we need to nullify the tx_rings pointer (if
any, I still need to investigate this) is not related to this init function.
Here we're safe.
Anyway, a V2 is already submitted, please use it for your next comments.
I think patch is OK.
next prev parent reply other threads:[~2018-05-10 15:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 7:02 [PATCH] net/mlx4_en: Fix an error handling path in 'mlx4_en_init_netdev()' Christophe JAILLET
2018-05-10 13:38 ` Yuval Shaia
2018-05-10 14:18 ` Dan Carpenter
2018-05-10 14:36 ` Tariq Toukan
2018-05-10 15:03 ` Tariq Toukan [this message]
2018-05-10 14:35 ` Christophe JAILLET
-- strict thread matches above, loose matches on Subject: below --
2018-05-08 9:34 Christophe JAILLET
2018-05-09 10:31 ` Tariq Toukan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49d89081-95d8-e7ae-2903-372a201ff92c@mellanox.com \
--to=tariqt@mellanox.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yuval.shaia@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox