From: sashiko-bot@kernel.org
To: "Aditya Garg" <gargaditya@linux.microsoft.com>
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH net 2/2] net: mana: guard TX wq object destroy with INVALID_MANA_HANDLE check
Date: Fri, 05 Jun 2026 08:02:07 +0000 [thread overview]
Message-ID: <20260605080208.283311F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260604080137.1995269-3-gargaditya@linux.microsoft.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] In `mana_create_vport()`, if `mana_create_txq()` fails, the function returns the error directly without unwinding the previously successful `mana_cfg_vport()` and `mana_pf_register_hw_vport()`. Similarly, if `mana_cfg_vport()` fails, it returns the error without unwinding `mana_pf_register_hw_vport()`. This leaks firmware vPort registrations and leaves `apc->vport_use_count > 0`, leading to a permanent `-EBUSY` error on all future attempts to open the device.
--
commit 22337dc3f6a86510c8d8b1e096424ad2f6000592
Author: Aditya Garg <gargaditya@linux.microsoft.com>
net: mana: guard TX wq object destroy with INVALID_MANA_HANDLE check
This commit fixes an issue where mana_destroy_txq() attempts to destroy a
WQ object using INVALID_MANA_HANDLE if allocation fails earlier. It adds
a check to verify the handle is valid before calling mana_destroy_wq_obj().
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index db14357d3732e..4a2cd800111e7 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -2351,7 +2351,8 @@ static void mana_destroy_txq(struct mana_port_context *apc)
> netif_napi_del_locked(napi);
> apc->tx_qp[i]->txq.napi_initialized = false;
> }
> - mana_destroy_wq_obj(apc, GDMA_SQ, apc->tx_qp[i]->tx_object);
> + if (apc->tx_qp[i]->tx_object != INVALID_MANA_HANDLE)
> + mana_destroy_wq_obj(apc, GDMA_SQ, apc->tx_qp[i]->tx_object);
>
> mana_deinit_cq(apc, &apc->tx_qp[i]->tx_cq);
>
[Severity: High]
This is a pre-existing issue, but while reviewing the error paths that lead
to mana_destroy_txq(), I noticed a potential resource leak in
mana_create_vport().
If mana_create_txq() fails, the function returns the error directly without
unwinding the previously successful mana_cfg_vport() and
mana_pf_register_hw_vport():
drivers/net/ethernet/microsoft/mana/mana_en.c:mana_create_vport() {
...
err = mana_cfg_vport(apc, gd->pdid, gd->doorbell);
if (err)
return err;
return mana_create_txq(apc, net);
}
The same applies if mana_cfg_vport() fails, as it returns the error without
unwinding mana_pf_register_hw_vport().
Because mana_alloc_queues() propagates this error without calling
mana_destroy_vport() or unwinding the partial initialization:
drivers/net/ethernet/microsoft/mana/mana_en.c:mana_alloc_queues() {
...
err = mana_create_vport(apc, ndev);
if (err) {
netdev_err(ndev, "Failed to create vPort %u : %d\n", apc->port_idx, err);
return err;
}
...
}
Does this leak firmware vPort registrations and leave apc->vport_use_count > 0,
leading to a permanent -EBUSY error on all future attempts to open the device?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260604080137.1995269-1-gargaditya@linux.microsoft.com?part=2
next prev parent reply other threads:[~2026-06-05 8:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 8:01 [PATCH net 0/2] net: mana: fix error-path issues in queue setup Aditya Garg
2026-06-04 8:01 ` [PATCH net 1/2] net: mana: initialize gdma queue id to INVALID_QUEUE_ID Aditya Garg
2026-06-04 8:01 ` [PATCH net 2/2] net: mana: guard TX wq object destroy with INVALID_MANA_HANDLE check Aditya Garg
2026-06-05 8:02 ` sashiko-bot [this message]
2026-06-06 1:27 ` [PATCH net 0/2] net: mana: fix error-path issues in queue setup Jakub Kicinski
2026-06-08 4:43 ` Aditya Garg
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=20260605080208.283311F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=gargaditya@linux.microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.