From: Simon Horman <horms@kernel.org>
To: Jijie Shao <shaojijie@huawei.com>
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch, shenjian15@huawei.com,
liuyonglong@huawei.com, chenhao418@huawei.com,
yangshuaisong@h-partners.com, ningwei15@huawei.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 net 1/4] net: hns3: fix vector resource leak in hns3_nic_alloc_vector_data
Date: Wed, 25 Nov 2026 10:38:01 +0000 [thread overview]
Message-ID: <20261125103801.GO31322@horms.kernel.org> (raw)
In-Reply-To: <20261118130330.3026625-2-shaojijie@huawei.com>
On Wed, Nov 18, 2026 at 09:03:27PM +0800, Jijie Shao wrote:
> When devm_kcalloc() fails for priv->tqp_vector after get_vector() has
> already acquired MSI-X vectors, the error path returns without calling
> put_vector() to release them, leaving the hclge/hclgevf bookkeeping
> (num_msi_used, num_msi_left, vector_status[]) inconsistent.
>
> Call put_vector() for every acquired vector before returning the error,
> and reset priv->vector_num to 0 so the count never describes vectors
> that were already handed back.
>
> Fixes: dd38c72604dc ("net: hns3: fix for coalesce configuration lost during reset")
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> ---
> Changes in v4:
> - Correct the reason for resetting priv->vector_num. Sashiko pointed
> out that hns3_nic_dealloc_vector_data() is not reachable after
> hns3_nic_alloc_vector_data() fails, so the reset is not protecting
> that path; it keeps the count from describing vectors that were
> already handed back.
> v3: https://lore.kernel.org/all/20261030095633.377289-2-shaojijie@huawei.com/
> Changes in v3:
> - Simplify commit message: drop the accumulated-leak consequence
> paragraph and clarify that the vector_num reset avoids a NULL
> deref in hns3_nic_dealloc_vector_data().
> v2: https://lore.kernel.org/all/20261021121426.3096838-2-shaojijie@huawei.com/
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2026-11-25 10:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 13:03 [PATCH net v5 0/4] net: hns3: fix multiple bugs in reset/error paths Jijie Shao
2026-11-18 13:03 ` [PATCH v5 net 1/4] net: hns3: fix vector resource leak in hns3_nic_alloc_vector_data Jijie Shao
2026-11-25 10:38 ` Simon Horman [this message]
2026-11-18 13:03 ` [PATCH v5 net 2/4] net: hns3: fix page_pool leak in hns3_alloc_ring_memory error path Jijie Shao
2026-11-25 10:38 ` Simon Horman
2026-11-18 13:03 ` [PATCH v5 net 3/4] net: hns3: fix interface stuck after OOM with full hardware rx queue Jijie Shao
2026-11-22 13:24 ` netdev-bot+sashiko
2026-11-23 7:33 ` Jijie Shao
2026-11-25 10:38 ` Simon Horman
2026-11-18 13:03 ` [PATCH v5 net 4/4] net: hns3: fix use-after-free in debugfs read during reset/unload Jijie Shao
2026-11-22 13:24 ` netdev-bot+sashiko
2026-11-23 7:43 ` Jijie Shao
2026-11-25 10:39 ` Simon Horman
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=20261125103801.GO31322@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=chenhao418@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=ningwei15@huawei.com \
--cc=pabeni@redhat.com \
--cc=shaojijie@huawei.com \
--cc=shenjian15@huawei.com \
--cc=yangshuaisong@h-partners.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