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

Signed-off-by: Ying Fang <fangying1@huawei.com>
This commit is contained in:
Ying Fang 2020-01-13 11:32:53 +08:00 committed by xuding
parent 835b11517d
commit eb23f6e929
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,21 @@
There is a possible memory leak while local_link return -1 without free
odirpath and oname.
Reported-by: Euler Robot <euler.robot@huawei.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Jaijun Chen <chenjiajun8@huawei.com>
Signed-off-by: Xiang Zheng <zhengxiang9@huawei.com>
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);

View File

@ -83,6 +83,7 @@ Patch0070: migration-Fix-use-after-free-during-process-exit.patch
Patch0071: linux-headers-update-against-KVM-ARM-Fix-256-vcpus.patch
Patch0072: intc-arm_gic-Support-IRQ-injection-for-more-than-256.patch
Patch0073: ARM-KVM-Check-KVM_CAP_ARM_IRQ_LINE_LAYOUT_2-for-smp_.patch
Patch0074: 9pfs-local-Fix-possible-memory-leak-in-local_link.patch
BuildRequires: flex
BuildRequires: bison
@ -413,12 +414,15 @@ getent passwd qemu >/dev/null || \
%endif
%changelog
* Mon Jan 13 2020 Huawei Technologies Co., Ltd. <fangying1@huawei.com>
- 9pfs: Fix a possible memory leak in local_link
* Mon Jan 6 2020 backport from qemu upstream
- linux headers: update against "KVM/ARM: Fix >256 vcp
- intc/arm_gic: Support IRQ injection for more than 256 vpus
- ARM: KVM: Check KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 for smp_cpus > 256
* Fri Nov 12 2019 backport from qemu upstream v4.0.1 release
* Thu Dec 12 2019 backport from qemu upstream v4.0.1 release
- usb-tablet: fix serial compat property
- blockdev-backup: don't check aio_context too early
- migration/dirty-bitmaps: change bitmap enumeration method