* [PATCH] app/testpmd: fix action destruction memory leak
@ 2022-11-17 8:55 Suanming Mou
2022-11-17 11:41 ` David Marchand
2022-11-18 10:40 ` Ferruh Yigit
0 siblings, 2 replies; 5+ messages in thread
From: Suanming Mou @ 2022-11-17 8:55 UTC (permalink / raw)
To: david.marchand, Aman Singh, Yuying Zhang; +Cc: dev
In case action handle destroy fails, the job memory was not freed
properly. This commit fixes the possible memory leak in the action
handle destruction failed case.
Fixes: c9dc03840873 ("ethdev: add indirect action async query")
Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
---
app/test-pmd/config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 982549ffed..719bdd4261 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2873,9 +2873,9 @@ port_queue_action_handle_destroy(portid_t port_id,
job->type = QUEUE_JOB_TYPE_ACTION_DESTROY;
job->pia = pia;
- if (pia->handle &&
- rte_flow_async_action_handle_destroy(port_id,
+ if (rte_flow_async_action_handle_destroy(port_id,
queue_id, &attr, pia->handle, job, &error)) {
+ free(job);
ret = port_flow_complain(&error);
continue;
}
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] app/testpmd: fix action destruction memory leak
2022-11-17 8:55 [PATCH] app/testpmd: fix action destruction memory leak Suanming Mou
@ 2022-11-17 11:41 ` David Marchand
2022-11-18 10:40 ` Ferruh Yigit
1 sibling, 0 replies; 5+ messages in thread
From: David Marchand @ 2022-11-17 11:41 UTC (permalink / raw)
To: Suanming Mou
Cc: Aman Singh, Yuying Zhang, dev, Andrew Rybchenko, Ferruh Yigit,
Thomas Monjalon
On Thu, Nov 17, 2022 at 9:56 AM Suanming Mou <suanmingm@nvidia.com> wrote:
>
> In case action handle destroy fails, the job memory was not freed
> properly. This commit fixes the possible memory leak in the action
> handle destruction failed case.
>
> Fixes: c9dc03840873 ("ethdev: add indirect action async query")
>
Reported-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
LGTM.
Reviewed-by: David Marchand <david.marchand@redhat.com>
Thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] app/testpmd: fix action destruction memory leak
2022-11-17 8:55 [PATCH] app/testpmd: fix action destruction memory leak Suanming Mou
2022-11-17 11:41 ` David Marchand
@ 2022-11-18 10:40 ` Ferruh Yigit
2022-11-18 12:21 ` Suanming Mou
1 sibling, 1 reply; 5+ messages in thread
From: Ferruh Yigit @ 2022-11-18 10:40 UTC (permalink / raw)
To: Suanming Mou, david.marchand, Aman Singh, Yuying Zhang; +Cc: dev
On 11/17/2022 8:55 AM, Suanming Mou wrote:
> In case action handle destroy fails, the job memory was not freed
> properly. This commit fixes the possible memory leak in the action
> handle destruction failed case.
>
> Fixes: c9dc03840873 ("ethdev: add indirect action async query")
>
> Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
> ---
> app/test-pmd/config.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 982549ffed..719bdd4261 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -2873,9 +2873,9 @@ port_queue_action_handle_destroy(portid_t port_id,
> job->type = QUEUE_JOB_TYPE_ACTION_DESTROY;
> job->pia = pia;
>
> - if (pia->handle &&
> - rte_flow_async_action_handle_destroy(port_id,
> + if (rte_flow_async_action_handle_destroy(port_id,
Why 'pia->handle' check removed, was it unnecessary to check it at first
place?
> queue_id, &attr, pia->handle, job, &error)) {
> + free(job);
> ret = port_flow_complain(&error);
> continue;
> }
Just to double check, when this if branch not taken,
'rte_flow_async_action_handle_destroy()' not failed case, testpmd
'port_queue_flow_pull()' functions frees the 'job', right?
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] app/testpmd: fix action destruction memory leak
2022-11-18 10:40 ` Ferruh Yigit
@ 2022-11-18 12:21 ` Suanming Mou
2022-11-18 15:19 ` Ferruh Yigit
0 siblings, 1 reply; 5+ messages in thread
From: Suanming Mou @ 2022-11-18 12:21 UTC (permalink / raw)
To: Ferruh Yigit, david.marchand, Aman Singh, Yuying Zhang; +Cc: dev
Hi,
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Friday, November 18, 2022 6:40 PM
> To: Suanming Mou <suanmingm@nvidia.com>; david.marchand@redhat.com;
> Aman Singh <aman.deep.singh@intel.com>; Yuying Zhang
> <yuying.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [PATCH] app/testpmd: fix action destruction memory leak
>
> On 11/17/2022 8:55 AM, Suanming Mou wrote:
> > In case action handle destroy fails, the job memory was not freed
> > properly. This commit fixes the possible memory leak in the action
> > handle destruction failed case.
> >
> > Fixes: c9dc03840873 ("ethdev: add indirect action async query")
> >
> > Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
> > ---
> > app/test-pmd/config.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index
> > 982549ffed..719bdd4261 100644
> > --- a/app/test-pmd/config.c
> > +++ b/app/test-pmd/config.c
> > @@ -2873,9 +2873,9 @@ port_queue_action_handle_destroy(portid_t
> port_id,
> > job->type = QUEUE_JOB_TYPE_ACTION_DESTROY;
> > job->pia = pia;
> >
> > - if (pia->handle &&
> > - rte_flow_async_action_handle_destroy(port_id,
> > + if (rte_flow_async_action_handle_destroy(port_id,
>
> Why 'pia->handle' check removed, was it unnecessary to check it at first place?
>
> > queue_id, &attr, pia->handle, job, &error)) {
> > + free(job);
> > ret = port_flow_complain(&error);
> > continue;
> > }
>
> Just to double check, when this if branch not taken,
> 'rte_flow_async_action_handle_destroy()' not failed case, testpmd
> 'port_queue_flow_pull()' functions frees the 'job', right?
Yes, port_queue_flow_pull() will free the 'job'.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] app/testpmd: fix action destruction memory leak
2022-11-18 12:21 ` Suanming Mou
@ 2022-11-18 15:19 ` Ferruh Yigit
0 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2022-11-18 15:19 UTC (permalink / raw)
To: Suanming Mou, david.marchand, Aman Singh, Yuying Zhang; +Cc: dev
On 11/18/2022 12:21 PM, Suanming Mou wrote:
> Hi,
>
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@amd.com>
>> Sent: Friday, November 18, 2022 6:40 PM
>> To: Suanming Mou <suanmingm@nvidia.com>; david.marchand@redhat.com;
>> Aman Singh <aman.deep.singh@intel.com>; Yuying Zhang
>> <yuying.zhang@intel.com>
>> Cc: dev@dpdk.org
>> Subject: Re: [PATCH] app/testpmd: fix action destruction memory leak
>>
>> On 11/17/2022 8:55 AM, Suanming Mou wrote:
>>> In case action handle destroy fails, the job memory was not freed
>>> properly. This commit fixes the possible memory leak in the action
>>> handle destruction failed case.
>>>
>>> Fixes: c9dc03840873 ("ethdev: add indirect action async query")
>>>
>>> Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
>>> ---
>>> app/test-pmd/config.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index
>>> 982549ffed..719bdd4261 100644
>>> --- a/app/test-pmd/config.c
>>> +++ b/app/test-pmd/config.c
>>> @@ -2873,9 +2873,9 @@ port_queue_action_handle_destroy(portid_t
>> port_id,
>>> job->type = QUEUE_JOB_TYPE_ACTION_DESTROY;
>>> job->pia = pia;
>>>
>>> - if (pia->handle &&
>>> - rte_flow_async_action_handle_destroy(port_id,
>>> + if (rte_flow_async_action_handle_destroy(port_id,
>>
>> Why 'pia->handle' check removed, was it unnecessary to check it at first place?
This seems already discussed and agreed in other thread, so proceeding.
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-18 15:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17 8:55 [PATCH] app/testpmd: fix action destruction memory leak Suanming Mou
2022-11-17 11:41 ` David Marchand
2022-11-18 10:40 ` Ferruh Yigit
2022-11-18 12:21 ` Suanming Mou
2022-11-18 15:19 ` Ferruh Yigit
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).