qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 9pfs: local: Fix possible memory leak in local_link()
@ 2019-12-20  9:49 Jiajun Chen
  2019-12-20 14:42 ` Christian Schoenebeck
  2019-12-23 10:59 ` Greg Kurz
  0 siblings, 2 replies; 4+ messages in thread
From: Jiajun Chen @ 2019-12-20  9:49 UTC (permalink / raw)
  To: groug; +Cc: qemu-devel, xiexiangyou

There is a possible memory leak while local_link return -1 without free
odirpath and oname.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Jaijun Chen <chenjiajun8@huawei.com>
Signed-off-by: Xiang Zheng <zhengxiang9@huawei.com>
---
 hw/9pfs/9p-local.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index 4708c0bd89..491b08aee8 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -947,7 +947,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
     if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
         local_is_mapped_file_metadata(ctx, name)) {
         errno = EINVAL;
-        return -1;
+        goto out;
     }
 
     odirfd = local_opendir_nofollow(ctx, odirpath);
-- 
2.21.0.windows.1




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] 9pfs: local: Fix possible memory leak in local_link()
  2019-12-20  9:49 [PATCH] 9pfs: local: Fix possible memory leak in local_link() Jiajun Chen
@ 2019-12-20 14:42 ` Christian Schoenebeck
  2019-12-23 10:59 ` Greg Kurz
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Schoenebeck @ 2019-12-20 14:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jiajun Chen, Greg Kurz, xiexiangyou

On Freitag, 20. Dezember 2019 10:49:34 CET Jiajun Chen wrote:
> There is a possible memory leak while local_link return -1 without free
> odirpath and oname.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Jaijun Chen <chenjiajun8@huawei.com>
> Signed-off-by: Xiang Zheng <zhengxiang9@huawei.com>

Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>

> ---
>  hw/9pfs/9p-local.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
> index 4708c0bd89..491b08aee8 100644
> --- a/hw/9pfs/9p-local.c
> +++ b/hw/9pfs/9p-local.c
> @@ -947,7 +947,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
> if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
>          local_is_mapped_file_metadata(ctx, name)) {
>          errno = EINVAL;
> -        return -1;
> +        goto out;
>      }
> 
>      odirfd = local_opendir_nofollow(ctx, odirpath);

Best regards,
Christian Schoenebeck




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] 9pfs: local: Fix possible memory leak in local_link()
  2019-12-20  9:49 [PATCH] 9pfs: local: Fix possible memory leak in local_link() Jiajun Chen
  2019-12-20 14:42 ` Christian Schoenebeck
@ 2019-12-23 10:59 ` Greg Kurz
  2020-01-06 11:07   ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 4+ messages in thread
From: Greg Kurz @ 2019-12-23 10:59 UTC (permalink / raw)
  To: Jiajun Chen; +Cc: Christian Schoenebeck, qemu-devel, xiexiangyou

On Fri, 20 Dec 2019 17:49:34 +0800
Jiajun Chen <chenjiajun8@huawei.com> wrote:

> There is a possible memory leak while local_link return -1 without free
> odirpath and oname.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Jaijun Chen <chenjiajun8@huawei.com>
> Signed-off-by: Xiang Zheng <zhengxiang9@huawei.com>
> ---

Applied to 9p-next.

Thanks.

>  hw/9pfs/9p-local.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
> index 4708c0bd89..491b08aee8 100644
> --- a/hw/9pfs/9p-local.c
> +++ b/hw/9pfs/9p-local.c
> @@ -947,7 +947,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
>      if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
>          local_is_mapped_file_metadata(ctx, name)) {
>          errno = EINVAL;
> -        return -1;
> +        goto out;
>      }
>  
>      odirfd = local_opendir_nofollow(ctx, odirpath);



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] 9pfs: local: Fix possible memory leak in local_link()
  2019-12-23 10:59 ` Greg Kurz
@ 2020-01-06 11:07   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-01-06 11:07 UTC (permalink / raw)
  To: Greg Kurz, Jiajun Chen; +Cc: Christian Schoenebeck, qemu-devel, xiexiangyou

On 12/23/19 11:59 AM, Greg Kurz wrote:
> On Fri, 20 Dec 2019 17:49:34 +0800
> Jiajun Chen <chenjiajun8@huawei.com> wrote:
> 
>> There is a possible memory leak while local_link return -1 without free
>> odirpath and oname.
>>
>> Reported-by: Euler Robot <euler.robot@huawei.com>
>> Signed-off-by: Jaijun Chen <chenjiajun8@huawei.com>
>> Signed-off-by: Xiang Zheng <zhengxiang9@huawei.com>
>> ---
> 
> Applied to 9p-next.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> 
> Thanks.
> 
>>   hw/9pfs/9p-local.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
>> index 4708c0bd89..491b08aee8 100644
>> --- a/hw/9pfs/9p-local.c
>> +++ b/hw/9pfs/9p-local.c
>> @@ -947,7 +947,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
>>       if (ctx->export_flags & V9FS_SM_MAPPED_FILE &&
>>           local_is_mapped_file_metadata(ctx, name)) {
>>           errno = EINVAL;
>> -        return -1;
>> +        goto out;
>>       }
>>   
>>       odirfd = local_opendir_nofollow(ctx, odirpath);
> 
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-06 11:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-20  9:49 [PATCH] 9pfs: local: Fix possible memory leak in local_link() Jiajun Chen
2019-12-20 14:42 ` Christian Schoenebeck
2019-12-23 10:59 ` Greg Kurz
2020-01-06 11:07   ` Philippe Mathieu-Daudé

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).