mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 2/4] net: hns3: fix page_pool leak in hns3_alloc_ring_memory error path
Date: Wed, 25 Nov 2026 10:38:25 +0000	[thread overview]
Message-ID: <20261125103825.GP31322@horms.kernel.org> (raw)
In-Reply-To: <20261118130330.3026625-3-shaojijie@huawei.com>

On Wed, Nov 18, 2026 at 09:03:28PM +0800, Jijie Shao wrote:
> In hns3_alloc_ring_memory(), when hns3_alloc_ring_buffers() fails for
> an RX ring, the error path jumps to out_with_desc, which frees the
> descriptor ring but does not destroy the page_pool that was just
> allocated by hns3_alloc_page_pool(). The page_pool and its pages are
> leaked.
> 
> Destroy the page_pool in that error path as well. The pool is torn down
> before the descriptor ring here, which is the opposite of the order in
> hns3_fini_ring(); that is safe because hns3_alloc_ring_buffers() has
> already detached every buffer it attached, so hns3_free_desc() walks
> descriptors whose dma is zero and never hands a page back to the pool.
> 
> Fixes: 93188e9642c3 ("net: hns3: support skb's frag page recycling based on page pool")
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> ---
> Changes in v4:
>   - Name hns3_fini_ring() instead of the non-existent
>     hns3_free_ring_memory(), and drop "mirroring" because the destroy
>     order differs.  The pool is destroyed before the descriptor ring
>     here, which is safe because hns3_alloc_ring_buffers() has already
>     detached every buffer.
> v3: https://lore.kernel.org/all/20261030095633.377289-3-shaojijie@huawei.com/

Reviewed-by: Simon Horman <horms@kernel.org>


  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
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 [this message]
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=20261125103825.GP31322@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

all inboxes | Powered by JetHome®