public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Ouyang Hao" <ouyanghao@tencent.com>
Cc: dev@dpdk.org, ciara.loftus@intel.com, mtahhan@redhat.com,
	stable@dpdk.org
Subject: Re: [PATCH] net/af_xdp: fix resource leak in eth_dev_close
Date: Tue, 7 Apr 2026 07:14:31 -0700	[thread overview]
Message-ID: <20260407071431.0809fb24@phoenix.local> (raw)
In-Reply-To: <FEA1D5B98F367DFC+20260407021428.620-1-ouyanghao@tencent.com>

On Tue,  7 Apr 2026 10:14:28 +0800
"Ouyang Hao" <ouyanghao@tencent.com> wrote:

> The rx_queues and tx_queues arrays are allocated as contiguous
> blocks via rte_zmalloc_socket() in init_internals(). However,
> eth_dev_close() incorrectly calls rte_free() on individual array
> elements (rxq and rxq->pair) inside the per-queue cleanup loop.
> 
> Since rte_free(&rx_queues[0]) releases the entire contiguous
> block, the memory backing queues[1..N-1] becomes invalid after
> the first iteration. On subsequent iterations, accessing the
> freed memory may read NULL (or garbage), causing the loop to
> break early via the (rxq->umem == NULL) check.
> 
> This results in:
> - XSK sockets for queues 1..N-1 not being deleted
> - UMEM reference counts not being decremented, leaking memory
> - Potential use-after-free if freed memory is reallocated
> 
> Fix by removing the per-element rte_free() calls from inside
> the loop and instead freeing the entire tx_queues and rx_queues
> arrays after the loop completes.
> 
> Fixes: 339b88c6a91f ("net/af_xdp: support multi-queue")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ouyang Hao <ouyanghao@tencent.com>
> ---

Applied to next-net, added your email to the .mailmap

  reply	other threads:[~2026-04-07 14:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07  2:14 [PATCH] net/af_xdp: fix resource leak in eth_dev_close =?gb18030?B?T3V5YW5nIEhhbw==?=
2026-04-07 14:14 ` Stephen Hemminger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-04-03 12:40 =?gb18030?B?T3V5YW5nIEhhbw==?=

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=20260407071431.0809fb24@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=ciara.loftus@intel.com \
    --cc=dev@dpdk.org \
    --cc=mtahhan@redhat.com \
    --cc=ouyanghao@tencent.com \
    --cc=stable@dpdk.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