[PATCH v2 09/10] block/file-posix: fix a possible undefined behavior

2020-08-31 Thread Pan Nengyuan
local_err is not initialized to NULL, it will cause a assert error as below: qemu/util/error.c:59: error_setv: Assertion `*errp == NULL' failed. Fixes: c6447510690 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Stefano Garzarella --- Cc: Kevin Wolf Cc: Max Reitz Cc

[PATCH v2 08/10] blockdev: Fix a memleak in drive_backup_prepare()

2020-08-31 Thread Pan Nengyuan
'local_err' seems forgot to propagate in error path, it'll cause a memleak. Fix it. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Kevin Wolf Reviewed-by: Li Qiang --- Cc: Kevin Wolf Cc: Max Reitz Cc: Markus Armbruster Cc: qemu-block@nongnu.org --- - V2: no changes in v2

[PATCH 10/12] block/file-posix: fix a possible undefined behavior

2020-08-14 Thread Pan Nengyuan
local_err is not initialized to NULL, it will cause a assert error as below: qemu/util/error.c:59: error_setv: Assertion `*errp == NULL' failed. Fixes: c6447510690 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Kevin Wolf Cc: Max Reitz Cc: Aarushi Mehta Cc: qemu-block

[PATCH 09/12] blockdev: Fix a memleak in drive_backup_prepare()

2020-08-14 Thread Pan Nengyuan
'local_err' seems forgot to propagate in error path, it'll cause a memleak. Fix it. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Kevin Wolf Cc: Max Reitz Cc: Markus Armbruster Cc: qemu-block@nongnu.org --- blockdev.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH v4 1/2] virtio-blk: delete vqs on the error path in realize()

2020-03-27 Thread Pan Nengyuan
/sdb/qemu/hw/core/qdev.c:891 #6 0x5562cd39cd45 in property_set_bool /mnt/sdb/qemu/qom/object.c:2238 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Stefano Garzarella --- v2->v1: - Fix incorrect free in v1, it will cause a uaf. --- Cc: Stefan Hajnoczi Cc: Kevin Wolf

[PATCH v3 1/2] virtio-blk: delete vqs on the error path in realize()

2020-03-27 Thread Pan Nengyuan
/sdb/qemu/hw/core/qdev.c:891 #6 0x5562cd39cd45 in property_set_bool /mnt/sdb/qemu/qom/object.c:2238 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Stefano Garzarella --- v2->v1: - Fix incorrect free in v1, it will cause a uaf. --- Cc: Stefan Hajnoczi Cc: Kevin Wolf

Re: [PATCH 1/2] virtio-blk: delete vqs on the error path in realize()

2020-03-27 Thread Pan Nengyuan
On 3/27/2020 4:41 PM, Stefano Garzarella wrote: > On Fri, Mar 27, 2020 at 11:56:49AM +0800, Pan Nengyuan wrote: >> virtio_vqs forgot to free on the error path in realize(). Fix that. >> >> The asan stack: >> Direct leak of 14336 byte(s) in 1 object(s) allocated fro

[PATCH v2 1/2] virtio-blk: delete vqs on the error path in realize()

2020-03-26 Thread Pan Nengyuan
/sdb/qemu/hw/core/qdev.c:891 #6 0x5562cd39cd45 in property_set_bool /mnt/sdb/qemu/qom/object.c:2238 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- v2->v1: - Fix incorrect free in v1, it will cause a uaf. --- Cc: Stefan Hajnoczi Cc: Kevin Wolf Cc: Max Reitz Cc: qemu-bl

[PATCH 1/2] virtio-blk: delete vqs on the error path in realize()

2020-03-26 Thread Pan Nengyuan
/sdb/qemu/hw/core/qdev.c:891 #6 0x5562cd39cd45 in property_set_bool /mnt/sdb/qemu/qom/object.c:2238 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Stefan Hajnoczi Cc: Kevin Wolf Cc: Max Reitz Cc: qemu-block@nongnu.org --- hw/block/virtio-blk.c | 8 ++-- 1 file changed, 6

[PATCH v2 2/2] qemu-img: free memory before re-assign

2020-02-26 Thread Pan Nengyuan
-by: Pan Nengyuan --- v2->v1: - Instead of freeing part of props in collect_image_check(), do discard the old check object and allocate a new one in the caller to make more sense.(suggested by Max Reitz) --- qemu-img.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qemu-img.c b/qemu-im

[PATCH v2 1/2] block/qcow2: do free crypto_opts in qcow2_close()

2020-02-26 Thread Pan Nengyuan
/qemu-new/qemu_test/qemu/block/qcow2.c:3668 #18 0x55d7eac1c678 in bdrv_create_co_entry /mnt/sdb/qemu-new/qemu_test/qemu/block.c:485 #19 0x55d7eb0024d2 in coroutine_trampoline /mnt/sdb/qemu-new/qemu_test/qemu/util/coroutine-ucontext.c:115 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan

[PATCH v2 0/2] fix two small memleaks

2020-02-26 Thread Pan Nengyuan
eck object and allocate a new one in the caller to make more sense.(suggested by Max Reitz) Pan Nengyuan (2): block/qcow2: do free crypto_opts in qcow2_close() qemu-img: free memory before re-assign block/qcow2.c | 1 + qemu-img.c| 2 ++ 2 files changed, 3 insertions(+) -- 2.18.2

Re: [PATCH 2/2] qemu-img: free memory before re-assign

2020-02-26 Thread Pan Nengyuan
On 2/26/2020 6:13 PM, Max Reitz wrote: > On 26.02.20 04:30, Pan Nengyuan wrote: >> collect_image_check() is called twice in img_check(), the filename/format >> will be alloced without free the original memory. >> It is not a big deal since the process will exit a

[PATCH 0/2] fix two small memleaks

2020-02-25 Thread Pan Nengyuan
This series fix two small memleaks. 1. 'crypto_opts' forgot to free in qcow2_close(), do this cleanup in qcow2_close(); 2. Do free filename/format in collect_image_check() when we re-allocate it. Pan Nengyuan (2): block/qcow2: do free crypto_opts in qcow2_close() qemu-img: free memory

[PATCH 1/2] block/qcow2: do free crypto_opts in qcow2_close()

2020-02-25 Thread Pan Nengyuan
/qemu-new/qemu_test/qemu/block/qcow2.c:3668 #18 0x55d7eac1c678 in bdrv_create_co_entry /mnt/sdb/qemu-new/qemu_test/qemu/block.c:485 #19 0x55d7eb0024d2 in coroutine_trampoline /mnt/sdb/qemu-new/qemu_test/qemu/util/coroutine-ucontext.c:115 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan

[PATCH 2/2] qemu-img: free memory before re-assign

2020-02-25 Thread Pan Nengyuan
-by: Pan Nengyuan --- qemu-img.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qemu-img.c b/qemu-img.c index 2b4562b9d9..bcbca6c9a2 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -638,6 +638,8 @@ static int collect_image_check(BlockDriverState *bs, return ret; } +g_free

Re: [PATCH 2/2] vhost-use-blk: convert to new virtio_delete_queue

2020-02-21 Thread Pan Nengyuan
On 2/21/2020 7:31 PM, Stefan Hajnoczi wrote: > On Thu, Feb 13, 2020 at 09:28:07AM +0800, pannengy...@huawei.com wrote: >> diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c >> index 2eba8b9db0..ed6a5cc03b 100644 >> --- a/hw/block/vhost-user-blk.c >> +++

Re: [PATCH] backup-top: fix a memory leak in bdrv_backup_top_append()

2020-01-20 Thread Pan Nengyuan
.@huawei.com wrote: >> From: Pan Nengyuan >> >> top->opaque is aleardy malloced in bdrv_new_open_driver(), and then change >> the pointer but without freeing it. It will cause a memory leak, the leak >> stack is as follow: >> >> Direct leak of 24 byte(s)

Re: [PATCH] scsi-disk: define props in scsi_block_disk to avoid memleaks

2020-01-13 Thread Pan Nengyuan
On 1/14/2020 6:56 AM, John Snow wrote: > CC qemu-block > > On 1/13/20 1:20 AM, pannengy...@huawei.com wrote: >> From: Pan Nengyuan >> >> scsi_block_realize() use scsi_realize() to init some props, but >> these props is not defined in scsi_block_disk_propert

Re: [PATCH] nbd: fix uninitialized variable warning

2020-01-07 Thread Pan Nengyuan
On 1/8/2020 6:24 AM, Eric Blake wrote: > On 1/5/20 7:54 PM, pannengy...@huawei.com wrote: >> From: Pan Nengyuan >> >> Fixes: >> /mnt/sdb/qemu/nbd/server.c: In function 'nbd_handle_request': >> /mnt/sdb/qemu/nbd/server.c:2313:9: error: 'ret' may be used u

Re: [PATCH V3 1/2] block/nbd: extract the common cleanup code

2019-12-03 Thread Pan Nengyuan
On 2019/12/4 15:19, Vladimir Sementsov-Ogievskiy wrote: > 04.12.2019 6:12, pannengyuan wrote: >> >> >> On 2019/12/4 1:38, Vladimir Sementsov-Ogievskiy wrote: >>> Hi! >>> >>> First, please, when sending more than one patch, create a cover-letter. >>> Also, >>> summarize (in cover letter) what