From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Ma Ke <make24@iscas.ac.cn>
Cc: <linux-hyperv@vger.kernel.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <kys@microsoft.com>,
<haiyangz@microsoft.com>, <wei.liu@kernel.org>,
<decui@microsoft.com>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<shradhagupta@linux.microsoft.com>, <horms@kernel.org>,
<kotaranov@microsoft.com>, <schakrabarti@linux.microsoft.com>,
<erick.archer@outlook.com>
Subject: Re: [PATCH v2] net: mana: Fix possible double free in error handling path
Date: Tue, 25 Jun 2024 11:13:41 +0200 [thread overview]
Message-ID: <08bbd282-081f-433f-8b23-ba1cf7d95110@intel.com> (raw)
In-Reply-To: <20240625083816.2623936-1-make24@iscas.ac.cn>
On 6/25/24 10:38, Ma Ke wrote:
> When auxiliary_device_add() returns error and then calls
> auxiliary_device_uninit(), callback function adev_release
> calls kfree(madev). We shouldn't call kfree(madev) again
> in the error handling path. Set 'madev' to NULL.
>
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
> ---
> Changes in v2:
> - streamlined the patch according suggestions;
> - revised the description.
> ---
> drivers/net/ethernet/microsoft/mana/mana_en.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index d087cf954f75..608ad31a9702 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -2798,6 +2798,8 @@ static int add_adev(struct gdma_dev *gd)
> if (ret)
> goto init_fail;
>
> + /* madev is owned by the auxiliary device */
> + madev = NULL;
> ret = auxiliary_device_add(adev);
> if (ret)
> goto add_fail;
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
next prev parent reply other threads:[~2024-06-25 9:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 8:38 [PATCH v2] net: mana: Fix possible double free in error handling path Ma Ke
2024-06-25 9:13 ` Przemek Kitszel [this message]
2024-06-25 9:38 ` Konstantin Taranov
2024-06-25 9:41 ` Konstantin Taranov
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=08bbd282-081f-433f-8b23-ba1cf7d95110@intel.com \
--to=przemyslaw.kitszel@intel.com \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=edumazet@google.com \
--cc=erick.archer@outlook.com \
--cc=haiyangz@microsoft.com \
--cc=horms@kernel.org \
--cc=kotaranov@microsoft.com \
--cc=kuba@kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=make24@iscas.ac.cn \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=schakrabarti@linux.microsoft.com \
--cc=shradhagupta@linux.microsoft.com \
--cc=wei.liu@kernel.org \
/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