9pfs: local: Fix possible memory leak in local_link()
PATCH 1/1 9pfs: local: Fix possible memory leak in local_link()
There is a possible memory leak while local_link return -1 without free odirpath and oname.
Reported-by Euler Robot <[email protected]>
Signed-off-by Jaijun Chen <[email protected]>
Signed-off-by Xiang Zheng <[email protected]>
--- hw/9pfs/9p-local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/9pfs/9p-local.c +1 -1
@@ -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);
Signature · 1 line
2.21.0.windows.1
Quoted 6 lines · On Freitag, 20. Dezember 2019 10:49:34 CET Jiajun Chen wrote:
There is a possible memory leak while
local_linkreturn -1 without free odirpath and oname.Reported-by Euler Robot <[email protected]>Signed-off-by Jaijun Chen <[email protected]>Signed-off-by Xiang Zheng <[email protected]>
Reviewed-by Christian Schoenebeck <[email protected]>
Quoted 12 lines
--- hw/9pfs/9p-local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/9pfs/9p-local.c +0
-0@@ -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;
hw/9pfs/9p-local.c static int local_link(FsContext *ctx, V9fsPath *oldpath, · line 953
Quoted 5 lines
hw/9pfs/9p-local.c +1
-1-return -1 ; + goto out; } odirfd =local_opendir_nofollow (ctx, odirpath);
Best regards,
Christian Schoenebeck
Greg Kurz
AppliedQuoted 7 lines · On Fri, 20 Dec 2019 17:49:34 +0800 Jiajun Chen <[email protected]> wrote:
There is a possible memory leak while
local_linkreturn -1 without free odirpath and oname.Reported-by Euler Robot <[email protected]>Signed-off-by Jaijun Chen <[email protected]>Signed-off-by Xiang Zheng <[email protected]>---
Applied to 9p-next.
Thanks.
Quoted 16 lines
hw/9pfs/9p-local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/9pfs/9p-local.c +1
-1@@ -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);
Philippe Mathieu-Daudé
Reviewed-byQuoted 6 lines · Greg Kurz
Quoted 3 lines · On Fri, 20 Dec 2019 17:49:34 +0800 Jiajun Chen <[email protected]> wrote:
There is a possible memory leak while
local_linkreturn -1 without free odirpath and oname.
Quoted 6 lines
Quoted 4 lines
Reported-by Euler Robot <[email protected]>Signed-off-by Jaijun Chen <[email protected]>Signed-off-by Xiang Zheng <[email protected]>---
Applied to 9p-next.
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 21 lines
Thanks.
Quoted 16 lines
hw/9pfs/9p-local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/9pfs/9p-local.c +1
-1@@ -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);