[PATCH v7 2/4] migration/multifd: Fix p->iov leak in multifd-uadk.c

Fabiano Rosas posted 4 patches 2 months, 3 weeks ago
[PATCH v7 2/4] migration/multifd: Fix p->iov leak in multifd-uadk.c
Posted by Fabiano Rosas 2 months, 3 weeks ago
The send_cleanup() hook should free the p->iov that was allocated at
send_setup(). This was missed because the UADK code is conditional on
the presence of the accelerator, so it's not tested by default.

Fixes: 819dd20636 ("migration/multifd: Add UADK initialization")
Reported-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 migration/multifd-uadk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/migration/multifd-uadk.c b/migration/multifd-uadk.c
index 89f6a72f0e..6e6a290ae9 100644
--- a/migration/multifd-uadk.c
+++ b/migration/multifd-uadk.c
@@ -132,6 +132,8 @@ static void multifd_uadk_send_cleanup(MultiFDSendParams *p, Error **errp)
 
     multifd_uadk_uninit_sess(wd);
     p->compress_data = NULL;
+    g_free(p->iov);
+    p->iov = NULL;
 }
 
 static inline void prepare_next_iov(MultiFDSendParams *p, void *base,
-- 
2.35.3
Re: [PATCH v7 2/4] migration/multifd: Fix p->iov leak in multifd-uadk.c
Posted by Michael Tokarev 2 months, 2 weeks ago
28.08.2024 17:56, Fabiano Rosas wrote:
> The send_cleanup() hook should free the p->iov that was allocated at
> send_setup(). This was missed because the UADK code is conditional on
> the presence of the accelerator, so it's not tested by default.
> 
> Fixes: 819dd20636 ("migration/multifd: Add UADK initialization")
> Reported-by: Peter Xu <peterx@redhat.com>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   migration/multifd-uadk.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/migration/multifd-uadk.c b/migration/multifd-uadk.c
> index 89f6a72f0e..6e6a290ae9 100644
> --- a/migration/multifd-uadk.c
> +++ b/migration/multifd-uadk.c
> @@ -132,6 +132,8 @@ static void multifd_uadk_send_cleanup(MultiFDSendParams *p, Error **errp)
>   
>       multifd_uadk_uninit_sess(wd);
>       p->compress_data = NULL;
> +    g_free(p->iov);
> +    p->iov = NULL;
>   }

This sounds like something for stable-9.1.x, is it not?

Thanks,

/mjt
Re: [PATCH v7 2/4] migration/multifd: Fix p->iov leak in multifd-uadk.c
Posted by Fabiano Rosas 2 months, 2 weeks ago
Michael Tokarev <mjt@tls.msk.ru> writes:

> 28.08.2024 17:56, Fabiano Rosas wrote:
>> The send_cleanup() hook should free the p->iov that was allocated at
>> send_setup(). This was missed because the UADK code is conditional on
>> the presence of the accelerator, so it's not tested by default.
>> 
>> Fixes: 819dd20636 ("migration/multifd: Add UADK initialization")
>> Reported-by: Peter Xu <peterx@redhat.com>
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> ---
>>   migration/multifd-uadk.c | 2 ++
>>   1 file changed, 2 insertions(+)
>> 
>> diff --git a/migration/multifd-uadk.c b/migration/multifd-uadk.c
>> index 89f6a72f0e..6e6a290ae9 100644
>> --- a/migration/multifd-uadk.c
>> +++ b/migration/multifd-uadk.c
>> @@ -132,6 +132,8 @@ static void multifd_uadk_send_cleanup(MultiFDSendParams *p, Error **errp)
>>   
>>       multifd_uadk_uninit_sess(wd);
>>       p->compress_data = NULL;
>> +    g_free(p->iov);
>> +    p->iov = NULL;
>>   }
>
> This sounds like something for stable-9.1.x, is it not?

Right, it is.

>
> Thanks,
>
> /mjt
Re: [PATCH v7 2/4] migration/multifd: Fix p->iov leak in multifd-uadk.c
Posted by Peter Xu 2 months, 3 weeks ago
On Wed, Aug 28, 2024 at 11:56:48AM -0300, Fabiano Rosas wrote:
> The send_cleanup() hook should free the p->iov that was allocated at
> send_setup(). This was missed because the UADK code is conditional on
> the presence of the accelerator, so it's not tested by default.
> 
> Fixes: 819dd20636 ("migration/multifd: Add UADK initialization")
> Reported-by: Peter Xu <peterx@redhat.com>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>

Thanks.

Reviewed-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu