DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@oss.nxp.com>
To: Maxime Leroy <maxime@leroys.fr>, dev@dpdk.org
Cc: hemant.agrawal@nxp.com, sachin.saxena@nxp.com, david.marchand@redhat.com
Subject: Re: [PATCH v3 1/6] event/dpaa2: disable channel before closing it
Date: Fri, 3 Jul 2026 22:51:14 +0530	[thread overview]
Message-ID: <19dd309f-a2c7-4ccc-9067-e8116239bcb7@oss.nxp.com> (raw)
In-Reply-To: <20260630144329.457643-2-maxime@leroys.fr>

[-- Attachment #1: Type: text/plain, Size: 2016 bytes --]


On 30-06-2026 20:13, Maxime Leroy wrote:
> rte_dpaa2_close_dpcon_device() called dpcon_close() but not
> dpcon_disable(). close only releases the MC control session; it does not
> disable the channel. Cosmetic: an idle DPCON generates nothing and every
> consumer reprograms on setup, so disable before close only to return the
> channel clean, as the symmetric counterpart of the dpcon_enable() done on
> setup.
>
> Signed-off-by: Maxime Leroy<maxime@leroys.fr>
> ---
>   drivers/event/dpaa2/dpaa2_hw_dpcon.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> index ea5b0d4b85..f65a63a786 100644
> --- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> +++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> @@ -128,6 +128,7 @@ rte_dpaa2_close_dpcon_device(int object_id)
>   
>   	if (dpcon_dev) {
>   		rte_dpaa2_free_dpcon_dev(dpcon_dev);
> +		dpcon_disable(&dpcon_dev->dpcon, CMD_PRI_LOW, dpcon_dev->token);
>   		dpcon_close(&dpcon_dev->dpcon, CMD_PRI_LOW, dpcon_dev->token);
>   		TAILQ_REMOVE(&dpcon_dev_list, dpcon_dev, next);
>   		rte_free(dpcon_dev);

The ordering here is wrong. |rte_dpaa2_free_dpcon_dev(dpcon_dev)| is 
called *before* |dpcon_disable()|. Once the device is returned to the 
shared pool via |rte_dpaa2_free_dpcon_dev()|, another thread can 
immediately re-allocate the same |dpcon_dev| pointer. The subsequent 
|dpcon_disable()| call would then quiesce a channel already in active 
use by the new owner — a use-after-free on the pool object.

The correct teardown sequence must be:

 1. dpcon_disable() — quiesce the hardware channel
 2. dpcon_close() — release the MC control session
 3. rte_dpaa2_free_dpcon_dev() — return to pool

Please reorder accordingly:

dpcon_disable(&dpcon_dev->dpcon, CMD_PRI_LOW, dpcon_dev->token);

dpcon_close(&dpcon_dev->dpcon, CMD_PRI_LOW, dpcon_dev->token);

  TAILQ_REMOVE(&dpcon_dev_list, dpcon_dev, next);

  rte_dpaa2_free_dpcon_dev(dpcon_dev);

  rte_free(dpcon_dev);



[-- Attachment #2: Type: text/html, Size: 3979 bytes --]

  reply	other threads:[~2026-07-03 17:21 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 15:49 [PATCH 0/9] net/dpaa2: NAPI-style Rx queue interrupts Maxime Leroy
2026-06-11 15:49 ` [PATCH 1/9] net/dpaa2: implement RSS RETA query and update Maxime Leroy
2026-06-11 15:49 ` [PATCH 2/9] eal/interrupts: keep real errno on epoll error Maxime Leroy
2026-06-16  8:02   ` David Marchand
2026-06-16  9:29     ` David Marchand
2026-06-11 15:49 ` [PATCH 3/9] bus/fslmc: move DPCON management from event driver to bus Maxime Leroy
2026-06-11 15:49 ` [PATCH 4/9] bus/fslmc/dpio: make the portal DQRI epoll optional Maxime Leroy
2026-06-11 15:49 ` [PATCH 5/9] net/dpaa2: support Rx queue interrupts Maxime Leroy
2026-06-16  8:05   ` David Marchand
2026-06-11 15:49 ` [PATCH 6/9] bus/fslmc/dpio: tune DQRI interrupt coalescing holdoff Maxime Leroy
2026-06-11 15:49 ` [PATCH 7/9] net/dpaa2: fix Rx queue count for primary process Maxime Leroy
2026-06-11 15:49 ` [PATCH 8/9] ethdev: keep fast-path ops valid after port stop Maxime Leroy
2026-06-11 16:01   ` Morten Brørup
2026-06-11 18:39     ` Maxime Leroy
2026-06-12 15:00       ` Thomas Monjalon
2026-06-14 19:30   ` Stephen Hemminger
2026-06-15  9:26   ` David Marchand
2026-06-16  9:23     ` Maxime Leroy
2026-06-16  9:33       ` David Marchand
2026-06-11 15:49 ` [PATCH 9/9] net/dpaa2: drop the fake software VLAN strip offload Maxime Leroy
2026-06-11 15:56   ` Morten Brørup
2026-06-11 16:13     ` Morten Brørup
2026-06-11 16:58     ` Maxime Leroy
2026-06-11 17:30   ` Stephen Hemminger
2026-06-12  5:42     ` Maxime Leroy
2026-06-16 10:27 ` [PATCH v2 0/6] net/dpaa2: NAPI-style Rx queue interrupts Maxime Leroy
2026-06-16 10:27   ` [PATCH v2 1/6] bus/fslmc: move DPCON management from event driver to bus Maxime Leroy
2026-06-16 10:27   ` [PATCH v2 2/6] bus/fslmc/dpio: make the portal DQRI epoll optional Maxime Leroy
2026-06-16 10:27   ` [PATCH v2 3/6] net/dpaa2: support Rx queue interrupts Maxime Leroy
2026-06-18  8:46     ` David Marchand
2026-06-16 10:27   ` [PATCH v2 4/6] bus/fslmc/dpio: tune DQRI interrupt coalescing holdoff Maxime Leroy
2026-06-16 10:27   ` [PATCH v2 5/6] net/dpaa2: fix Rx queue count for primary process Maxime Leroy
2026-06-16 10:27   ` [PATCH v2 6/6] net/dpaa2: drop the fake software VLAN strip offload Maxime Leroy
2026-06-16 14:11     ` Stephen Hemminger
2026-06-16 15:40       ` Hemant Agrawal
2026-06-21  4:33   ` [PATCH v2 0/6] net/dpaa2: NAPI-style Rx queue interrupts Hemant Agrawal
2026-06-29 13:13     ` Maxime Leroy
2026-06-30 14:43   ` [PATCH v3 " Maxime Leroy
2026-06-30 14:43     ` [PATCH v3 1/6] event/dpaa2: disable channel before closing it Maxime Leroy
2026-07-03 17:21       ` Hemant Agrawal [this message]
2026-07-06  9:11         ` Maxime Leroy
2026-06-30 14:43     ` [PATCH v3 2/6] bus/fslmc: move DPCON management from event driver to bus Maxime Leroy
2026-06-30 14:43     ` [PATCH v3 3/6] bus/fslmc/dpio: make the portal DQRI epoll optional Maxime Leroy
2026-06-30 14:43     ` [PATCH v3 4/6] bus/fslmc/mc: implement dpcon_set_notification Maxime Leroy
2026-06-30 14:43     ` [PATCH v3 5/6] net/dpaa2: support Rx queue interrupts Maxime Leroy
2026-07-03 17:21       ` Hemant Agrawal
2026-07-06 10:36         ` Maxime Leroy
2026-06-30 14:43     ` [PATCH v3 6/6] net/dpaa2: pin Rx queue interrupt to the polling core Maxime Leroy
2026-07-03 16:03     ` [PATCH v3 0/6] net/dpaa2: NAPI-style Rx queue interrupts Stephen Hemminger
2026-07-03 18:56       ` Maxime Leroy
2026-07-03 20:26         ` Stephen Hemminger

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=19dd309f-a2c7-4ccc-9067-e8116239bcb7@oss.nxp.com \
    --to=hemant.agrawal@oss.nxp.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=maxime@leroys.fr \
    --cc=sachin.saxena@nxp.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