Re: [PATCH v2 00/10] fix some error memleaks

2020-10-10 Thread Pan Nengyuan
/11745625/ https://patchwork.kernel.org/patch/11745627/ https://patchwork.kernel.org/patch/11745635/ On 2020/9/21 10:12, Pan Nengyuan wrote: > ping! > > and cc: qemu-triv...@nongnu.org > > On 2020/9/17 20:49, Pan Nengyuan wrote: >> ping! >> >> Anyone queued the rest(p

Re: [PATCH] target/i386/cpu: add return value verification and ignore Error objects

2020-10-10 Thread Pan Nengyuan
ping! Maybe missed to queue? On 2020/9/4 21:20, Philippe Mathieu-Daudé wrote: > On 9/4/20 3:45 PM, Pan Nengyuan wrote: >> 'err' is unnecessary in x86_cpu_class_check_missing_features(), we can >> change x86_cpu_expand_features() >> to return true on success, f

Re: [PATCH] net/filter-rewriter: destroy g_hash_table in colo_rewriter_cleanup

2020-10-10 Thread Pan Nengyuan
ping! Maybe missed to queue? On 2020/9/5 8:44, Li Qiang wrote: > Pan Nengyuan 于2020年9月4日周五 下午3:23写道: >> >> s->connection_track_table forgot to destroy in colo_rewriter_cleanup. Fix it. >> >> Reported-by: Euler Robot >> Signed-off-by: Pan Nengyuan > >

Re: [RFC PATCH 2/2] .mailmap: Fix more contributor entries

2020-10-10 Thread Pan Nengyuan
Marcel Apfelbaum > Cc: Pan Nengyuan > Cc: Stefan Berger > Signed-off-by: Philippe Mathieu-Daudé > --- Acked-by: Pan Nengyuan

Re: [PATCH v2 00/10] fix some error memleaks

2020-09-20 Thread Pan Nengyuan
ping! and cc: qemu-triv...@nongnu.org On 2020/9/17 20:49, Pan Nengyuan wrote: > ping! > > Anyone queued the rest(patch 01/02/03/07/08/09)? > > On 2020/8/31 21:43, Pan Nengyuan wrote: >> This series fix some Error/GError memleaks. >> >> V2: >> 1. remo

Re: [PATCH v2 00/10] fix some error memleaks

2020-09-17 Thread Pan Nengyuan
ping! Anyone queued the rest(patch 01/02/03/07/08/09)? On 2020/8/31 21:43, Pan Nengyuan wrote: > This series fix some Error/GError memleaks. > > V2: > 1. remove two patches.(One has aleardy applied. The other has fixed.) > 2. change patch 5/10 and 7/10. > > Pan N

[PATCH] test-vmstate: remove unnecessary code in match_interval_mapping_node

2020-09-09 Thread Pan Nengyuan
'str' is not used in match_interval_mapping_node(), remove it. Signed-off-by: Pan Nengyuan --- tests/test-vmstate.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index f8de709a0b..1c763015d0 100644 --- a/tests/test-vmstate.c +++ b/

[PATCH] net/filter-rewriter: destroy g_hash_table in colo_rewriter_cleanup

2020-09-04 Thread Pan Nengyuan
s->connection_track_table forgot to destroy in colo_rewriter_cleanup. Fix it. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- net/filter-rewriter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c index 1aaad101b6..9ff366d44f 100

[PATCH] target/i386/cpu: add return value verification and ignore Error objects

2020-09-04 Thread Pan Nengyuan
'err' is unnecessary in x86_cpu_class_check_missing_features(), we can change x86_cpu_expand_features() to return true on success, false on failure, then pass NULL here to remove it. Signed-off-by: Pan Nengyuan Suggested-by: Markus Armbruster --- target/i386/cpu.c | 15 +++--

Re: [PATCH v2 06/10] target/i386/cpu: Fix memleak in x86_cpu_class_check_missing_features

2020-09-01 Thread Pan Nengyuan
On 2020/9/1 20:03, Markus Armbruster wrote: > Pan Nengyuan writes: > >> 'err' forgot to free in x86_cpu_class_check_missing_features error path. >> Fix that. >> >> Reported-by: Euler Robot >> Signed-off-by: Pan Nengyuan >> Reviewed-by: L

[PATCH v2 10/10] vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string

2020-08-31 Thread Pan Nengyuan
'addr' is forgot to free in vnc_socket_ip_addr_string error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang --- Cc: Gerd Hoffmann --- - V2: no changes in v2. --- ui/vnc-auth-sasl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/u

[PATCH v2 05/10] ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context()

2020-08-31 Thread Pan Nengyuan
Receiving error in local variable err, and forgot to free it. This patch check the return value of 'gdk_window_create_gl_context' and 'gdk_gl_context_realize', then free err to fix it. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Gerd Hoffmann --- V2->V1:

[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 Reit

[PATCH v2 06/10] target/i386/cpu: Fix memleak in x86_cpu_class_check_missing_features

2020-08-31 Thread Pan Nengyuan
'err' forgot to free in x86_cpu_class_check_missing_features error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang --- Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost --- - V2: no changes in v2. --- target/i386/cpu.c | 1

[PATCH v2 00/10] fix some error memleaks

2020-08-31 Thread Pan Nengyuan
This series fix some Error/GError memleaks. V2: 1. remove two patches.(One has aleardy applied. The other has fixed.) 2. change patch 5/10 and 7/10. Pan Nengyuan (10): qga/channel-posix: Plug memory leak in ga_channel_write_all() elf2dmp/qemu_elf: Plug memleak in QEMU_Elf_init elf2dmp

[PATCH v2 03/10] elf2dmp/pdb: Plug memleak in pdb_init_from_file

2020-08-31 Thread Pan Nengyuan
Missing g_error_free in pdb_init_from_file() error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Viktor Prutyanov Reviewed-by: Li Qiang --- Cc: Viktor Prutyanov --- - v2: no changes in v2 --- contrib/elf2dmp/pdb.c | 1 + 1 file changed, 1 insertion

[PATCH v2 02/10] elf2dmp/qemu_elf: Plug memleak in QEMU_Elf_init

2020-08-31 Thread Pan Nengyuan
Missing g_error_free in QEMU_Elf_init() error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Viktor Prutyanov Reviewed-by: Li Qiang --- Cc: Viktor Prutyanov --- - v2: no changes in v2 --- contrib/elf2dmp/qemu_elf.c | 1 + 1 file changed, 1 insertion

[PATCH v2 04/10] target/i386/sev: Plug memleak in sev_read_file_base64

2020-08-31 Thread Pan Nengyuan
Missing g_error_free() in sev_read_file_base64() error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang --- Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost --- - v2: no changes in v2 --- target/i386/sev.c | 1 + 1 file changed, 1

[PATCH v2 01/10] qga/channel-posix: Plug memory leak in ga_channel_write_all()

2020-08-31 Thread Pan Nengyuan
Missing g_error_free on error path in ga_channel_write_all(). Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Li Qiang --- Cc: Michael Roth --- - V2: no changes in v2 --- qga/channel-posix.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a

[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-bl...@nongnu.org --- - V2: n

[PATCH v2 07/10] migration/colo: Plug memleaks in colo_process_incoming_thread

2020-08-31 Thread Pan Nengyuan
'local_err' forgot to free in colo_process_incoming_thread error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Hailiang Zhang Cc: Juan Quintela Cc: "Dr. David Alan Gilbert" --- - V2: Arrange all 'error_report_err' in &#x

Re: [PATCH 06/12] ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context()

2020-08-27 Thread Pan Nengyuan
On 2020/8/26 20:20, Li Qiang wrote: > Pan Nengyuan 于2020年8月14日周五 下午6:15写道: >> >> Receiving error in local variable err, and forgot to free it. >> Considering that there is no place to deal with it. Clean up. >> >> Reported-by: Euler Robot >> Signed-o

Re: [PATCH 08/12] migration/colo: Plug memleaks in colo_process_incoming_thread

2020-08-26 Thread Pan Nengyuan
On 2020/8/26 20:37, Li Qiang wrote: > Pan Nengyuan 于2020年8月14日周五 下午6:52写道: >> >> 'local_err' forgot to free in colo_process_incoming_thread error path. >> Fix that. >> >> Reported-by: Euler Robot >> Signed-off-by: Pan Nengyuan >> ---

Re: [PATCH 00/12] fix some error memleaks

2020-08-25 Thread Pan Nengyuan
ping! On 2020/8/15 0:02, Pan Nengyuan wrote: > This series fix some Error/GError memleaks. > > Pan Nengyuan (12): > qga/channel-posix: Plug memory leak in ga_channel_write_all() > hw/vfio/ap: Plug memleak in vfio_ap_get_group() > elf2dmp/qemu_elf: Plug memleak in QEMU_El

Re: [PATCH 12/12] test-util-sockets: Fix a memleak in test_socket_unix_abstract_good

2020-08-15 Thread Pan Nengyuan
On 2020/8/14 22:50, Li Qiang wrote: > Pan Nengyuan 于2020年8月14日周五 下午6:18写道: >> >> Fix a memleak in test_socket_unix_abstract_good(). >> >> Reported-by: Euler Robot >> Signed-off-by: Pan Nengyuan >> --- > > Hi Nengyuan, > I have sent this two mo

[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-bl...@nongnu.org --- blockdev.c | 1 + 1 file changed, 1 insertion(+

[PATCH 08/12] migration/colo: Plug memleaks in colo_process_incoming_thread

2020-08-14 Thread Pan Nengyuan
'local_err' forgot to free in colo_process_incoming_thread error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Hailiang Zhang Cc: Juan Quintela Cc: "Dr. David Alan Gilbert" --- migration/colo.c | 2 ++ 1 file changed, 2 insertions(+) di

[PATCH 04/12] elf2dmp/pdb: Plug memleak in pdb_init_from_file

2020-08-14 Thread Pan Nengyuan
Missing g_error_free in pdb_init_from_file() error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Viktor Prutyanov --- contrib/elf2dmp/pdb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index a5bd40c99d

[PATCH 00/12] fix some error memleaks

2020-08-14 Thread Pan Nengyuan
This series fix some Error/GError memleaks. Pan Nengyuan (12): qga/channel-posix: Plug memory leak in ga_channel_write_all() hw/vfio/ap: Plug memleak in vfio_ap_get_group() elf2dmp/qemu_elf: Plug memleak in QEMU_Elf_init elf2dmp/pdb: Plug memleak in pdb_init_from_file target/i386/sev

[PATCH 11/12] vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string

2020-08-14 Thread Pan Nengyuan
'addr' forgot to free in vnc_socket_ip_addr_string error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Gerd Hoffmann --- ui/vnc-auth-sasl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index 7b2b09f242..

[PATCH 07/12] target/i386/cpu: Fix memleak in x86_cpu_class_check_missing_features

2020-08-14 Thread Pan Nengyuan
'err' forgot to free in x86_cpu_class_check_missing_features error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost --- target/i386/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/

[PATCH 05/12] target/i386/sev: Plug memleak in sev_read_file_base64

2020-08-14 Thread Pan Nengyuan
Missing g_error_free() in sev_read_file_base64() error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost --- target/i386/sev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/i386/sev.c b/target

[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: qe

[PATCH 01/12] qga/channel-posix: Plug memory leak in ga_channel_write_all()

2020-08-14 Thread Pan Nengyuan
Missing g_error_free on error path in ga_channel_write_all(). Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Michael Roth --- qga/channel-posix.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qga/channel-posix.c b/qga/channel-posix.c index

[PATCH 02/12] hw/vfio/ap: Plug memleak in vfio_ap_get_group()

2020-08-14 Thread Pan Nengyuan
Missing g_error_free() in vfio_ap_get_group() error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Cornelia Huck Cc: Thomas Huth Cc: Christian Borntraeger Cc: Tony Krowiak Cc: Halil Pasic Cc: Pierre Morel Cc: Alex Williamson Cc: qemu-s3...@nongnu.org --- hw

[PATCH 03/12] elf2dmp/qemu_elf: Plug memleak in QEMU_Elf_init

2020-08-14 Thread Pan Nengyuan
Missing g_error_free in QEMU_Elf_init() error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Viktor Prutyanov --- contrib/elf2dmp/qemu_elf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/elf2dmp/qemu_elf.c b/contrib/elf2dmp/qemu_elf.c index

[PATCH 12/12] test-util-sockets: Fix a memleak in test_socket_unix_abstract_good

2020-08-14 Thread Pan Nengyuan
Fix a memleak in test_socket_unix_abstract_good(). Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- tests/test-util-sockets.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test-util-sockets.c b/tests/test-util-sockets.c index 261dc48c03..5c4204a130 100644 --- a/tests/test

[PATCH 06/12] ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context()

2020-08-14 Thread Pan Nengyuan
Receiving error in local variable err, and forgot to free it. Considering that there is no place to deal with it. Clean up. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Gerd Hoffmann --- ui/gtk-gl-area.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a

Re: [PATCH] qom-hmp-cmds: fix a memleak in hmp_qom_get

2020-06-03 Thread Pan Nengyuan
On 6/3/2020 2:51 PM, Philippe Mathieu-Daudé wrote: > Hi Pan, > > On 6/3/20 9:03 AM, Pan Nengyuan wrote: >> 'obj' forgot to free at the end of hmp_qom_get(). Fix that. >> >> The leak stack: >> Direct leak of 40 byte(s) in 1 object(s)

[PATCH] qom-hmp-cmds: fix a memleak in hmp_qom_get

2020-06-02 Thread Pan Nengyuan
:66 Fixes: 89cf4fe34f4 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- qom/qom-hmp-cmds.c | 1 + 1 file changed, 1 insertion(+) diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c index f704b6949a..3d2a23292d 100644 --- a/qom/qom-hmp-cmds.c +++ b/qom/qom-hmp-cmds.c @@ -71,6 +71,7 @@ void h

[PATCH v2] i386/kvm: fix a use-after-free when vcpu plug/unplug

2020-05-13 Thread Pan Nengyuan
in monitor_qmp_dispatch /mnt/sdb/qemu/monitor/qmp.c:145 #9 0x5573c71dad4f in monitor_qmp_bh_dispatcher /mnt/sdb/qemu/monitor/qmp.c:234 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Philippe Mathieu-Daudé --- - v2: remove unnecessary set vmsentry to null(there is no non

Re: [PATCH] i386/kvm: fix a use-after-free when vcpu plug/unplug

2020-05-12 Thread Pan Nengyuan
On 5/12/2020 3:54 PM, Philippe Mathieu-Daudé wrote: > On 5/12/20 3:39 PM, Pan Nengyuan wrote: >> When we hotplug vcpus, cpu_update_state is added to vm_change_state_head >> in kvm_arch_init_vcpu(). But it forgot to delete in kvm_arch_destroy_vcpu() >> after >> unplu

[PATCH] i386/kvm: fix a use-after-free when vcpu plug/unplug

2020-05-12 Thread Pan Nengyuan
in monitor_qmp_dispatch /mnt/sdb/qemu/monitor/qmp.c:145 #9 0x5573c71dad4f in monitor_qmp_bh_dispatcher /mnt/sdb/qemu/monitor/qmp.c:234 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- target/i386/cpu.h | 1 + target/i386/kvm.c | 5 - 2 files changed, 5 insertions(+), 1 deletion

[PATCH 2/2] migration/rdma: cleanup rdma context before g_free to avoid memleaks

2020-05-07 Thread Pan Nengyuan
When error happen in initializing 'rdma_return_path', we should cleanup rdma context before g_free(rdma) to avoid some memleaks. This patch fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- migration/rdma.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletion

[PATCH 1/2] migration/rdma: fix potential nullptr access in rdma_start_incoming_migration

2020-05-07 Thread Pan Nengyuan
'rdma' is NULL when taking the first error branch in rdma_start_incoming_migration. And it will cause a null pointer access in label 'err'. Fix that. Fixes: 59c59c67ee6b0327ae932deb303caa47919aeb1e Signed-off-by: Pan Nengyuan --- migration/rdma.c | 4 +++- 1 file changed

[PATCH 0/2] migration/rdma: fix nullptr-def in rdma_start_incoming_migration

2020-05-07 Thread Pan Nengyuan
I fix a memleak in rdma_start_incoming_migration some time ago. https://patchwork.kernel.org/patch/11498191/ I'm sorry that it may cause a null-pointer access, this patch fix that. Since we are here, rdma_start_outgoing_migration has the similar memleak, fix it together. Pan Nengyu

Re: [PATCH] migration/rdma: fix a memleak on error path in rdma_start_incoming_migration

2020-05-07 Thread Pan Nengyuan
On 4/24/2020 5:46 PM, Dr. David Alan Gilbert wrote: > * Pan Nengyuan (pannengy...@huawei.com) wrote: >> 'rdma->host' is malloced in qemu_rdma_data_init, but forgot to free on the >> error >> path in rdma_start_incoming_migration(), this patch fix that. >>

[PATCH 0/2] migration/multifd: fix two memleaks

2020-05-05 Thread Pan Nengyuan
Fix two memleaks in multifd_send_thread/multifd_new_send_channel_async when error happen. Pan Nengyuan (2): migration/multifd: fix memleaks in multifd_new_send_channel_async migration/multifd: Do error_free after migrate_set_error to avoid memleaks migration/multifd.c | 5 + 1 file

[PATCH 2/2] migration/multifd: Do error_free after migrate_set_error to avoid memleaks

2020-05-05 Thread Pan Nengyuan
-thread-posix.c:519 #13 0x7f78159ae2dd in start_thread (/lib64/libpthread.so.0+0x82dd) #14 0x7f78156df4b2 in __GI___clone (/lib64/libc.so.6+0xfc4b2) Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- migration/multifd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migration

[PATCH 1/2] migration/multifd: fix memleaks in multifd_new_send_channel_async

2020-05-05 Thread Pan Nengyuan
qemu/io/channel-socket.c:168 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- migration/multifd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/multifd.c b/migration/multifd.c index cb6a4a3ab8..197d59294a 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -727,6 +

Re: [PATCH] op_helper: fix some compile warnings

2020-04-20 Thread Pan Nengyuan
On 4/20/2020 5:49 PM, Yoshinori Sato wrote: > On Mon, 20 Apr 2020 18:18:39 +0900, > Pan Nengyuan wrote: >> >> >> >> On 4/20/2020 4:50 PM, Yoshinori Sato wrote: >>> On Mon, 20 Apr 2020 14:49:59 +0900, >>> Pan Nengyuan wrote: >>>> >&g

Re: [PATCH] op_helper: fix some compile warnings

2020-04-20 Thread Pan Nengyuan
On 4/20/2020 4:50 PM, Yoshinori Sato wrote: > On Mon, 20 Apr 2020 14:49:59 +0900, > Pan Nengyuan wrote: >> >> We got the following compile-time warnings(gcc7.3): >> /mnt/sdb//qemu/target/rx/op_helper.c: In function ‘helper_scmpu’: >> /mnt/sdb/qemu/target/rx/op_help

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

2020-04-20 Thread Pan Nengyuan
Hi Paolo, On 2/19/2020 3:52 PM, Pan Nengyuan wrote: > > > On 1/22/2020 1:05 AM, Paolo Bonzini wrote: >> On 14/01/20 10:16, pannengy...@huawei.com wrote: >>> From: Pan Nengyuan >>> >>> scsi_block_realize() use scsi_realize() to init some pr

Re: [PATCH] migration/rdma: fix a memleak on error path in rdma_start_incoming_migration

2020-04-20 Thread Pan Nengyuan
Correcting zhang hailiang's email. On 4/20/2020 6:27 PM, Pan Nengyuan wrote: > 'rdma->host' is malloced in qemu_rdma_data_init, but forgot to free on the > error > path in rdma_start_incoming_migration(), this patch fix that. > > The leak stack: > Di

[PATCH] migration/rdma: fix a memleak on error path in rdma_start_incoming_migration

2020-04-20 Thread Pan Nengyuan
.so.6+0x23872) #9 0x55a04536b26d in _start (/mnt/sdb/qemu/build/x86_64-softmmu/qemu-system-x86_64+0x286926d) Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- migration/rdma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/rdma.c b/migration/rdma.c index f61587891b..967f

[PATCH] op_helper: fix some compile warnings

2020-04-19 Thread Pan Nengyuan
n this function [-Werror=maybe-uninitialized] env->psw_c = (tmp <= env->regs[2]); Actually, it looks like a false-positive because it will enter the body of while loop and init it for the first time. Let's change 'while' to 'do .. while' to avoid it. Repo

[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 v4 0/2] fix two virtio queues memleak

2020-03-27 Thread Pan Nengyuan
y_busptr' hash table in virtio_iommu_device_unrealize.(Suggested by Stefano Garzarella) v4->v3: - update patch2/2 subject message and move g_hash_table_destroy() at the beggining of unrealize(). Pan Nengyuan (2): virtio-blk: delete vqs on the error path in realize() virtio-iommu

[PATCH v4 2/2] virtio-iommu: avoid memleak in the unrealize

2020-03-27 Thread Pan Nengyuan
req_vq/event_vq forgot to free in unrealize. Fix that. And also do clean 's->as_by_busptr' hash table in unrealize to fix another leak. Signed-off-by: Pan Nengyuan Acked-by: Eric Auger --- Cc: Eric Auger Cc: Stefan Hajnoczi --- v3->v1/v2: - Also clean 's->as_by_busptr&

Re: [PATCH v3 2/2] virtio-iommu: delete vqs in unrealize to fix memleak

2020-03-27 Thread Pan Nengyuan
On 3/28/2020 12:26 AM, Stefano Garzarella wrote: > On Fri, Mar 27, 2020 at 05:56:42PM +0800, Pan Nengyuan wrote: >> req_vq/event_vq forgot to free in unrealize. Fix that. >> And aslo do clean 's->as_by_busptr' hash table in unrealize to fix another >> leak.

[PATCH v3 0/2] fix two virtio queues memleak

2020-03-27 Thread Pan Nengyuan
y_busptr' hash table in virtio_iommu_device_unrealize.(Suggested by Stefano Garzarella) Pan Nengyuan (2): virtio-blk: delete vqs on the error path in realize() virtio-iommu: delete vqs in unrealize to fix memleak hw/block/virtio-blk.c| 3 +++ hw/virtio/virtio-iommu.c | 3 +++

[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

[PATCH v3 2/2] virtio-iommu: delete vqs in unrealize to fix memleak

2020-03-27 Thread Pan Nengyuan
req_vq/event_vq forgot to free in unrealize. Fix that. And aslo do clean 's->as_by_busptr' hash table in unrealize to fix another leak. Signed-off-by: Pan Nengyuan Acked-by: Eric Auger --- Cc: Eric Auger --- v3->v1/v2: - Aslo clean 's->as_by_busptr' hash tab

Re: [PATCH 2/2] virtio-iommu: delete vqs in unrealize to fix memleaks

2020-03-27 Thread Pan Nengyuan
On 3/27/2020 4:53 PM, Stefano Garzarella wrote: > On Fri, Mar 27, 2020 at 11:56:50AM +0800, Pan Nengyuan wrote: >> req_vq/event_vq forgot to free in unrealize(). Fix that. >> >> Signed-off-by: Pan Nengyuan >> --- >> Cc: Eric Auger >> --- >> hw/vi

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 from:

[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

[PATCH v2 0/2] fix two virtio queues memleak

2020-03-26 Thread Pan Nengyuan
This series fix two vqs leak: 1. Do delete vqs on the error path in virtio_blk_device_realize(). 2. Do delete vqs in virtio_iommu_device_unrealize() to fix another leaks. v2->v1: - Fix incorrect free in v1, it will cause a uaf. Pan Nengyuan (2): virtio-blk: delete vqs on the error path

[PATCH v2 2/2] virtio-iommu: delete vqs in unrealize to fix memleak

2020-03-26 Thread Pan Nengyuan
req_vq/event_vq forgot to free in unrealize. Fix that. Signed-off-by: Pan Nengyuan --- Cc: Eric Auger --- hw/virtio/virtio-iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 4cee8083bc..9d2ff0693c 100644 --- a/hw/virtio

[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-bl...@nongnu.org --- hw/block/virtio-blk.c | 8 ++-- 1 file changed, 6

[PATCH 2/2] virtio-iommu: delete vqs in unrealize to fix memleaks

2020-03-26 Thread Pan Nengyuan
req_vq/event_vq forgot to free in unrealize(). Fix that. Signed-off-by: Pan Nengyuan --- Cc: Eric Auger --- hw/virtio/virtio-iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 4cee8083bc..9d2ff0693c 100644 --- a/hw/virtio

[PATCH 0/2] fix two virtio queues memleak

2020-03-26 Thread Pan Nengyuan
This series fix two vqs leak: 1. Do delete vqs on the error path in virtio_blk_device_realize(). 2. Do delete vqs in virtio_iommu_device_unrealize() to fix another leaks. Pan Nengyuan (2): virtio-blk: delete vqs on the error path in realize() virtio-iommu: delete vqs in unrealize to fix

Re: [PATCH] hmp-cmd: fix a missing_break warning

2020-03-18 Thread Pan Nengyuan
Correcting zhang hailiang's email. On 3/18/2020 3:16 PM, Pan Nengyuan wrote: > This fix coverity issues 94417686: > 1260break; > CID 94417686: (MISSING_BREAK) > 1261. unterminated_case: The case for value > "MIGRATION_PARAMETER_THROTTLE_TRIGGER_THRESH

[PATCH] hmp-cmd: fix a missing_break warning

2020-03-18 Thread Pan Nengyuan
LE_TRIGGER_THRESHOLD: 1262p->has_throttle_trigger_threshold = true; 1263visit_type_int(v, param, &p->throttle_trigger_threshold, &err); 1264case MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL: Fixes: dc14a470763c96fd9d360e1028ce38e8c3613a77 Reported-by: Euler

[PATCH v5 2/4] mac_via: fix incorrect creation of mos6522 device in mac_via

2020-03-14 Thread Pan Nengyuan
test fail. Then do the realize mos6522 device in the mac_vir_realize. Signed-off-by: Pan Nengyuan --- Cc: Laurent Vivier Cc: Mark Cave-Ayland --- v4->v3: - split v3 into two patches, this patch fix incorrect creation of mos6522, move inits and props from realize into init. v5->v4: -

[PATCH v5 3/4] hw/misc/macio: fix incorrect creation of mos6522's subclasses

2020-03-14 Thread Pan Nengyuan
There are two other places where we create mos6522's subclasses but forgot to realize it. This patch do the realize in these places to fix that. Signed-off-by: Pan Nengyuan --- Cc: Mark Cave-Ayland Cc: David Gibson Cc: qemu-...@nongnu.org --- v5: - Also fix incorrect creation of mos6

[PATCH v5 4/4] hw/misc/mos6522: move timer_new from init() into realize() to avoid memleaks

2020-03-14 Thread Pan Nengyuan
There are some memleaks when we call 'device_list_properties'. This patch move timer_new from init into realize to fix it. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Laurent Vivier Cc: Mark Cave-Ayland Cc: David Gibson Cc: qemu-...@nongnu.org --- v2->v1: -

[PATCH v5 1/4] s390x: fix memleaks in cpu_finalize

2020-03-14 Thread Pan Nengyuan
#12 0x558ba96c1b02 in qmp_human_monitor_command /mnt/sdb/qemu-new/qemu/monitor/misc.c:142 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Richard Henderson Cc: David Hildenbrand Cc: Cornelia Huck Cc: qemu-s3...@nongnu.org --- v2->v1: - Similarly to other cleanups, m

[PATCH v5 0/4] delay timer_new from init to realize to fix memleaks.

2020-03-14 Thread Pan Nengyuan
x_cpu_realize() and simply use errp instead a temporary variable. Pan Nengyuan (4): s390x: fix memleaks in cpu_finalize mac_via: fix incorrect creation of mos6522 device in mac_via hw/misc/macio: fix incorrect creation of mos6522's subclasses hw/misc/mos6522: move timer_new

[PATCH] qom-qmp-cmds: remove unnecessary alloc in qmp_object_add to fix memleak

2020-03-13 Thread Pan Nengyuan
aio_bh_call /mnt/sdb/qemu-new/qemu_test/qemu/util/async.c:136 Fixes: 5f07c4d60d091320186e7b0edaf9ed2cc16b2d1e Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Kevin Wolf --- hw/block/xen-block.c | 2 +- qom/qom-qmp-cmds.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions

[PATCH v2] qom-qmp-cmds: fix two memleaks in qmp_object_add

2020-03-09 Thread Pan Nengyuan
136 Fixes: 5f07c4d60d091320186e7b0edaf9ed2cc16b2d1e Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- v2->v1: - do not store both a const and non-const string in the same variable, change it to a non-const string. (Suggested by Daniel P. Berrangé) --- qom/qom-qmp-cmds.c | 16 ++-

Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via

2020-03-09 Thread Pan Nengyuan
On 3/10/2020 12:16 AM, Mark Cave-Ayland wrote: > On 09/03/2020 14:14, Markus Armbruster wrote: > >> Pan Nengyuan writes: >> >>> On 3/9/2020 8:34 PM, Markus Armbruster wrote: >>>> Peter Maydell writes: >>>> >>>>> On Mon, 9

Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via

2020-03-09 Thread Pan Nengyuan
On 3/9/2020 8:34 PM, Markus Armbruster wrote: > Peter Maydell writes: > >> On Mon, 9 Mar 2020 at 10:02, Pan Nengyuan wrote: >>> On 3/9/2020 5:21 PM, Peter Maydell wrote: >>>> Could you explain more? My thought is that we should be using >>>> sysb

Re: [PATCH] core/qdev: fix memleak in qdev_get_gpio_out_connector()

2020-03-09 Thread Pan Nengyuan
On 3/9/2020 5:16 PM, Laurent Vivier wrote: > Le 07/03/2020 à 11:39, Marc-André Lureau a écrit : >> Hi >> >> On Sat, Mar 7, 2020 at 3:53 AM Pan Nengyuan wrote: >>> >>> Fix a memory leak in qdev_get_gpio_out_connector(). >>> >>>

Re: [PATCH] qom-qmp-cmds: fix two memleaks in qmp_object_add

2020-03-09 Thread Pan Nengyuan
On 3/9/2020 6:15 PM, Daniel P. Berrangé wrote: > On Mon, Mar 09, 2020 at 10:51:45AM +0100, Igor Mammedov wrote: >> On Mon, 9 Mar 2020 17:22:12 +0800 >> Pan Nengyuan wrote: >> >>> 'type/id' forgot to free in qmp_object_add, this patch fix that. >>&g

Re: [PATCH] qom-qmp-cmds: fix two memleaks in qmp_object_add

2020-03-09 Thread Pan Nengyuan
On 3/9/2020 5:51 PM, Igor Mammedov wrote: > On Mon, 9 Mar 2020 17:22:12 +0800 > Pan Nengyuan wrote: > >> 'type/id' forgot to free in qmp_object_add, this patch fix that. >> >> The leak stack: >> Direct leak of 84 byte(s) in 6 object(s)

Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via

2020-03-09 Thread Pan Nengyuan
On 3/9/2020 5:21 PM, Peter Maydell wrote: > On Mon, 9 Mar 2020 at 00:56, Pan Nengyuan wrote: >> >> >> >> On 3/8/2020 9:29 PM, Peter Maydell wrote: >>> On Thu, 5 Mar 2020 at 06:39, Pan Nengyuan wrote: >>>> -/* Init VIAs 1 and 2 */ >>

[PATCH] qom-qmp-cmds: fix two memleaks in qmp_object_add

2020-03-09 Thread Pan Nengyuan
136 Fixes: 5f07c4d60d091320186e7b0edaf9ed2cc16b2d1e Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- qom/qom-qmp-cmds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 49db926fcc..ac59ba1aa8 100644 --- a/qom/qom-qmp-cmds.c +++

[PATCH v3] virtio-serial-bus: Plug memory leak on realize() error paths

2020-03-08 Thread Pan Nengyuan
virtser_port_device_realize /mnt/sdb/backup/qemu/hw/char/virtio-serial-bus.c:946 #5 0x56273dcc5040 in device_set_realized /mnt/sdb/backup/qemu/hw/core/qdev.c:891 #6 0x56273e5ebbce in property_set_bool /mnt/sdb/backup/qemu/qom/object.c:2238 #7 0x56273e5e5a9c in o

Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via

2020-03-08 Thread Pan Nengyuan
On 3/8/2020 9:29 PM, Peter Maydell wrote: > On Thu, 5 Mar 2020 at 06:39, Pan Nengyuan wrote: >> >> This patch fix a bug in mac_via where it failed to actually realize devices >> it was using. >> And move the init codes which inits the mos6522 objects and properti

Re: [PATCH v4 0/3] delay timer_new from init to realize to fix memleaks.

2020-03-08 Thread Pan Nengyuan
On 3/8/2020 9:39 PM, Peter Maydell wrote: > On Sun, 8 Mar 2020 at 11:58, Mark Cave-Ayland > wrote: >> I just tried this patchset applied on top of git master and it causes >> qemu-system-ppc >> to segfault on startup: >> >> $ gdb --args ./qemu-system-ppc >> ... >> ... >> Thread 1 "qemu-system-

[PATCH] core/qdev: fix memleak in qdev_get_gpio_out_connector()

2020-03-06 Thread Pan Nengyuan
Fix a memory leak in qdev_get_gpio_out_connector(). Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- hw/core/qdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 3937d1eb1a..85f062def7 100644 --- a/hw/core/qdev.c +++ b/hw/core

Re: [PATCH v2] virtio-serial-bus: do cleanup on the error path in realize() to avoid memleaks

2020-03-06 Thread Pan Nengyuan
On 3/6/2020 4:51 PM, Markus Armbruster wrote: > Pan Nengyuan writes: > >> port->bh forgot to delete on the error path, this patch add it to fix >> memleaks. It's easy to reproduce as follow(add a same nr port): > > Long line. Suggest: > > virtio-s

[PATCH v2] virtio-serial-bus: do cleanup on the error path in realize() to avoid memleaks

2020-03-05 Thread Pan Nengyuan
new /mnt/sdb/backup/qemu/util/main-loop.c:532 #4 0x56273d52e62e in virtser_port_device_realize /mnt/sdb/backup/qemu/hw/char/virtio-serial-bus.c:946 #5 0x56273dcc5040 in device_set_realized /mnt/sdb/backup/qemu/hw/core/qdev.c:891 #6 0x56273e5ebbce in property_set_bool /mnt

Re: [PATCH v4 3/3] hw/misc/mos6522: move timer_new from init() into realize() to avoid memleaks

2020-03-05 Thread Pan Nengyuan
On 3/6/2020 6:56 AM, David Gibson wrote: > On Thu, Mar 05, 2020 at 02:54:22PM +0800, Pan Nengyuan wrote: >> There are some memleaks when we call 'device_list_properties'. This patch >> move timer_new from init into realize to fix it. >> >> Reported-b

Re: [PATCH v4 1/3] s390x: fix memleaks in cpu_finalize

2020-03-05 Thread Pan Nengyuan
On 3/5/2020 4:34 PM, David Hildenbrand wrote: > >> #if !defined(CONFIG_USER_ONLY) >> MachineState *ms = MACHINE(qdev_get_machine()); >> unsigned int max_cpus = ms->smp.max_cpus; >> + >> +cpu->env.tod_timer = >> +timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_tod_timer, cpu); >> +

Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via

2020-03-04 Thread Pan Nengyuan
On 3/5/2020 2:54 PM, Pan Nengyuan wrote: > This patch fix a bug in mac_via where it failed to actually realize devices > it was using. > And move the init codes which inits the mos6522 objects and properties on > them from realize() > into init(). However, we keep qdev_se

Re: [PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via

2020-03-04 Thread Pan Nengyuan
On 3/5/2020 2:54 PM, Pan Nengyuan wrote: > This patch fix a bug in mac_via where it failed to actually realize devices > it was using. > And move the init codes which inits the mos6522 objects and properties on > them from realize() > into init(). However, we keep qdev_se

[PATCH v4 2/3] mac_via: fix incorrect creation of mos6522 device in mac_via

2020-03-04 Thread Pan Nengyuan
test fail. Then do the realize mos6522 device in the mac_vir_realize. Signed-off-by: Pan Nengyuan --- Cc: Laurent Vivier Cc: Mark Cave-Ayland --- v4->v3: - split v3 into two patches, this patch fix incorrect creation of mos6522, move inits and props from realize into init. The v3 is: ht

[PATCH v4 3/3] hw/misc/mos6522: move timer_new from init() into realize() to avoid memleaks

2020-03-04 Thread Pan Nengyuan
There are some memleaks when we call 'device_list_properties'. This patch move timer_new from init into realize to fix it. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Laurent Vivier Cc: Mark Cave-Ayland Cc: David Gibson Cc: qemu-...@nongnu.org --- v2->v1: -

[PATCH v4 1/3] s390x: fix memleaks in cpu_finalize

2020-03-04 Thread Pan Nengyuan
#12 0x558ba96c1b02 in qmp_human_monitor_command /mnt/sdb/qemu-new/qemu/monitor/misc.c:142 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan --- Cc: Richard Henderson Cc: David Hildenbrand Cc: Cornelia Huck Cc: qemu-s3...@nongnu.org --- v2->v1: - Similarly to other cleanups, m

  1   2   >