* [dpdk-stable] [PATCH] eventdev/eth_tx: fix queue_del function
@ 2021-11-09 7:33 Naga Harish K S V
2021-11-09 9:24 ` Jayatheerthan, Jay
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Naga Harish K S V @ 2021-11-09 7:33 UTC (permalink / raw)
To: jerinj, jay.jayatheerthan; +Cc: dev, stable
This patch fixes heap-use-after-free reported by ASAN,
please reference https://bugs.dpdk.org/show_bug.cgi?id=869
The application can use the queue_id as `-1` to delete all
the queues of the eth_device that are added to tx_adapter
instance.
In above case, the queue_del api is trying to use number of
queues from adapter level instead of eth_device queues.
When there are queues added from multiple eth devices,
it will result in heap-use-after-free as reported by ASAN.
This patch fixes the queue_del api to use correct number of
queues.
Bugzilla ID: 869
Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
---
lib/eventdev/rte_event_eth_tx_adapter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index da55d2c2dc..c17f33f098 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -864,7 +864,7 @@ txa_service_queue_del(uint8_t id,
uint16_t i, q, nb_queues;
int ret = 0;
- nb_queues = txa->nb_queues;
+ nb_queues = txa->txa_ethdev[port_id].nb_queues;
if (nb_queues == 0)
return 0;
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-stable] [PATCH] eventdev/eth_tx: fix queue_del function
2021-11-09 7:33 [dpdk-stable] [PATCH] eventdev/eth_tx: fix queue_del function Naga Harish K S V
@ 2021-11-09 9:24 ` Jayatheerthan, Jay
2021-11-09 9:54 ` David Marchand
2021-11-10 5:56 ` Naga Harish K S V
2021-11-10 6:00 ` [dpdk-stable] [PATCH v2] " Naga Harish K S V
2 siblings, 1 reply; 6+ messages in thread
From: Jayatheerthan, Jay @ 2021-11-09 9:24 UTC (permalink / raw)
To: Naga Harish K, S V, jerinj; +Cc: dev, stable, David Marchand
+ David Marchand, who reported this issue.
The change looks good to me. You can add my ack.
> -----Original Message-----
> From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Sent: Tuesday, November 9, 2021 1:04 PM
> To: jerinj@marvell.com; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH] eventdev/eth_tx: fix queue_del function
>
> This patch fixes heap-use-after-free reported by ASAN,
> please reference https://bugs.dpdk.org/show_bug.cgi?id=869
>
> The application can use the queue_id as `-1` to delete all
> the queues of the eth_device that are added to tx_adapter
> instance.
> In above case, the queue_del api is trying to use number of
> queues from adapter level instead of eth_device queues.
> When there are queues added from multiple eth devices,
> it will result in heap-use-after-free as reported by ASAN.
>
> This patch fixes the queue_del api to use correct number of
> queues.
>
> Bugzilla ID: 869
> Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> ---
> lib/eventdev/rte_event_eth_tx_adapter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
> index da55d2c2dc..c17f33f098 100644
> --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> @@ -864,7 +864,7 @@ txa_service_queue_del(uint8_t id,
> uint16_t i, q, nb_queues;
> int ret = 0;
>
> - nb_queues = txa->nb_queues;
> + nb_queues = txa->txa_ethdev[port_id].nb_queues;
> if (nb_queues == 0)
> return 0;
>
> --
> 2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-stable] [PATCH] eventdev/eth_tx: fix queue_del function
2021-11-09 9:24 ` Jayatheerthan, Jay
@ 2021-11-09 9:54 ` David Marchand
0 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2021-11-09 9:54 UTC (permalink / raw)
To: Jayatheerthan, Jay, Naga Harish K, S V; +Cc: jerinj, dev, stable
On Tue, Nov 9, 2021 at 10:24 AM Jayatheerthan, Jay
<jay.jayatheerthan@intel.com> wrote:
> > -----Original Message-----
> > From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Sent: Tuesday, November 9, 2021 1:04 PM
> > To: jerinj@marvell.com; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Cc: dev@dpdk.org; stable@dpdk.org
> > Subject: [PATCH] eventdev/eth_tx: fix queue_del function
> >
> > This patch fixes heap-use-after-free reported by ASAN,
> > please reference https://bugs.dpdk.org/show_bug.cgi?id=869
> >
> > The application can use the queue_id as `-1` to delete all
> > the queues of the eth_device that are added to tx_adapter
> > instance.
> > In above case, the queue_del api is trying to use number of
> > queues from adapter level instead of eth_device queues.
> > When there are queues added from multiple eth devices,
> > it will result in heap-use-after-free as reported by ASAN.
> >
> > This patch fixes the queue_del api to use correct number of
> > queues.
> >
> > Bugzilla ID: 869
> > Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
RTE>>event_eth_tx_adapter_autotest
+ ------------------------------------------------------- +
+ Test Suite : tx event eth adapter test suite
Port 0 MAC: 00 00 00 00 00 00
Port 1 MAC: 00 00 00 00 00 00
Failed to find a valid event device, testing with event_sw0 device
+ ------------------------------------------------------- +
+ TestCase [ 0] : tx_adapter_create_free succeeded
Invalid port_id=2
EVENTDEV: txa_service_adapter_free() line 743: 1 Tx queues not deleted
+ TestCase [ 1] : tx_adapter_queue_add_del succeeded
+ TestCase [ 2] : tx_adapter_start_stop succeeded
+ TestCase [ 3] : tx_adapter_service succeeded
+ TestCase [ 4] : tx_adapter_dynamic_device succeeded
+ ------------------------------------------------------- +
+ Test Suite Summary : tx event eth adapter test suite
+ ------------------------------------------------------- +
+ Tests Total : 5
+ Tests Skipped : 0
+ Tests Executed : 5
+ Tests Unsupported: 0
+ Tests Passed : 5
+ Tests Failed : 0
+ ------------------------------------------------------- +
Test OK
And no ASan splat.
Tested-by: David Marchand <david.marchand@redhat.com>
Thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-stable] [PATCH] eventdev/eth_tx: fix queue_del function
2021-11-09 7:33 [dpdk-stable] [PATCH] eventdev/eth_tx: fix queue_del function Naga Harish K S V
2021-11-09 9:24 ` Jayatheerthan, Jay
@ 2021-11-10 5:56 ` Naga Harish K S V
2021-11-10 6:00 ` [dpdk-stable] [PATCH v2] " Naga Harish K S V
2 siblings, 0 replies; 6+ messages in thread
From: Naga Harish K S V @ 2021-11-10 5:56 UTC (permalink / raw)
To: jerinj, jay.jayatheerthan; +Cc: dev, stable
This patch fixes heap-use-after-free reported by ASAN,
please reference https://bugs.dpdk.org/show_bug.cgi?id=869
The application can use the queue_id as `-1` to delete all
the queues of the eth_device that are added to tx_adapter
instance.
In above case, the queue_del api is trying to use number of
queues from adapter level instead of eth_device queues.
When there are queues added from multiple eth devices,
it will result in heap-use-after-free as reported by ASAN.
This patch fixes the queue_del api to use correct number of
queues.
Bugzilla ID: 869
Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
---
lib/eventdev/rte_event_eth_tx_adapter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index da55d2c2dc..c17f33f098 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -864,7 +864,7 @@ txa_service_queue_del(uint8_t id,
uint16_t i, q, nb_queues;
int ret = 0;
- nb_queues = txa->nb_queues;
+ nb_queues = txa->txa_ethdev[port_id].nb_queues;
if (nb_queues == 0)
return 0;
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-stable] [PATCH v2] eventdev/eth_tx: fix queue_del function
2021-11-09 7:33 [dpdk-stable] [PATCH] eventdev/eth_tx: fix queue_del function Naga Harish K S V
2021-11-09 9:24 ` Jayatheerthan, Jay
2021-11-10 5:56 ` Naga Harish K S V
@ 2021-11-10 6:00 ` Naga Harish K S V
2021-11-10 18:58 ` [dpdk-dev] " Jerin Jacob
2 siblings, 1 reply; 6+ messages in thread
From: Naga Harish K S V @ 2021-11-10 6:00 UTC (permalink / raw)
To: jerinj, jay.jayatheerthan; +Cc: dev, stable
This patch fixes heap-use-after-free reported by ASAN,
please reference https://bugs.dpdk.org/show_bug.cgi?id=869
The application can use the queue_id as `-1` to delete all
the queues of the eth_device that are added to tx_adapter
instance.
In above case, the queue_del api is trying to use number of
queues from adapter level instead of eth_device queues.
When there are queues added from multiple eth devices,
it will result in heap-use-after-free as reported by ASAN.
This patch fixes the queue_del api to use correct number of
queues.
Bugzilla ID: 869
Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
---
lib/eventdev/rte_event_eth_tx_adapter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index da55d2c2dc..c17f33f098 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -864,7 +864,7 @@ txa_service_queue_del(uint8_t id,
uint16_t i, q, nb_queues;
int ret = 0;
- nb_queues = txa->nb_queues;
+ nb_queues = txa->txa_ethdev[port_id].nb_queues;
if (nb_queues == 0)
return 0;
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v2] eventdev/eth_tx: fix queue_del function
2021-11-10 6:00 ` [dpdk-stable] [PATCH v2] " Naga Harish K S V
@ 2021-11-10 18:58 ` Jerin Jacob
0 siblings, 0 replies; 6+ messages in thread
From: Jerin Jacob @ 2021-11-10 18:58 UTC (permalink / raw)
To: Naga Harish K S V; +Cc: Jerin Jacob, Jayatheerthan, Jay, dpdk-dev, dpdk stable
On Wed, Nov 10, 2021 at 11:30 AM Naga Harish K S V
<s.v.naga.harish.k@intel.com> wrote:
>
> This patch fixes heap-use-after-free reported by ASAN,
> please reference https://bugs.dpdk.org/show_bug.cgi?id=869
>
> The application can use the queue_id as `-1` to delete all
> the queues of the eth_device that are added to tx_adapter
> instance.
> In above case, the queue_del api is trying to use number of
> queues from adapter level instead of eth_device queues.
> When there are queues added from multiple eth devices,
> it will result in heap-use-after-free as reported by ASAN.
>
> This patch fixes the queue_del api to use correct number of
> queues.
>
> Bugzilla ID: 869
> Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
> Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Updated the commit log as:
eventdev/eth_tx: fix queue delete logic
This patch fixes heap-use-after-free reported by ASan.
The application can use the queue_id as `-1` to delete all
the queues of the eth_device that are added to tx_adapter
instance.
In above case, the queue_del API is trying to use number of
queues from adapter level instead of eth_device queues.
When there are queues added from multiple eth devices,
it will result in heap-use-after-free as reported by ASAN.
This patch fixes the queue_del API to use correct number of
queues.
Bugzilla ID: 869
Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Tested-by: David Marchand <david.marchand@redhat.com>
Applied to dpdk-next-net-eventdev/for-main. Thanks
> ---
> lib/eventdev/rte_event_eth_tx_adapter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
> index da55d2c2dc..c17f33f098 100644
> --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> @@ -864,7 +864,7 @@ txa_service_queue_del(uint8_t id,
> uint16_t i, q, nb_queues;
> int ret = 0;
>
> - nb_queues = txa->nb_queues;
> + nb_queues = txa->txa_ethdev[port_id].nb_queues;
> if (nb_queues == 0)
> return 0;
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-11-10 18:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 7:33 [dpdk-stable] [PATCH] eventdev/eth_tx: fix queue_del function Naga Harish K S V
2021-11-09 9:24 ` Jayatheerthan, Jay
2021-11-09 9:54 ` David Marchand
2021-11-10 5:56 ` Naga Harish K S V
2021-11-10 6:00 ` [dpdk-stable] [PATCH v2] " Naga Harish K S V
2021-11-10 18:58 ` [dpdk-dev] " Jerin Jacob
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).