* Re: [PATCH 1/2] migration/rdma: fix potential nullptr access in rdma_start_incoming_migration
2020-05-08 10:07 ` [PATCH 1/2] migration/rdma: fix potential nullptr access " Pan Nengyuan
@ 2020-05-08 7:52 ` Juan Quintela
2020-05-11 9:34 ` Peter Maydell
2020-05-29 17:21 ` Dr. David Alan Gilbert
0 siblings, 2 replies; 8+ messages in thread
From: Juan Quintela @ 2020-05-08 7:52 UTC (permalink / raw)
To: Pan Nengyuan; +Cc: zhang.zhanghailiang, euler.robot, dgilbert, qemu-devel
Pan Nengyuan <pannengyuan@huawei.com> wrote:
> '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 <pannengyuan@huawei.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
good catch.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] migration/rdma: cleanup rdma context before g_free to avoid memleaks
2020-05-08 10:07 ` [PATCH 2/2] migration/rdma: cleanup rdma context before g_free to avoid memleaks Pan Nengyuan
@ 2020-05-08 7:54 ` Juan Quintela
2020-05-29 17:27 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 8+ messages in thread
From: Juan Quintela @ 2020-05-08 7:54 UTC (permalink / raw)
To: Pan Nengyuan; +Cc: zhang.zhanghailiang, euler.robot, dgilbert, qemu-devel
Pan Nengyuan <pannengyuan@huawei.com> wrote:
> 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 <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Another good catch.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 0/2] migration/rdma: fix nullptr-def in rdma_start_incoming_migration
@ 2020-05-08 10:07 Pan Nengyuan
2020-05-08 10:07 ` [PATCH 1/2] migration/rdma: fix potential nullptr access " Pan Nengyuan
2020-05-08 10:07 ` [PATCH 2/2] migration/rdma: cleanup rdma context before g_free to avoid memleaks Pan Nengyuan
0 siblings, 2 replies; 8+ messages in thread
From: Pan Nengyuan @ 2020-05-08 10:07 UTC (permalink / raw)
To: quintela, dgilbert
Cc: zhang.zhanghailiang, Pan Nengyuan, qemu-devel, euler.robot
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 Nengyuan (2):
migration/rdma: fix potential nullptr access in
rdma_start_incoming_migration
migration/rdma: cleanup rdma context before g_free to avoid memleaks
migration/rdma.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--
2.18.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] migration/rdma: fix potential nullptr access in rdma_start_incoming_migration
2020-05-08 10:07 [PATCH 0/2] migration/rdma: fix nullptr-def in rdma_start_incoming_migration Pan Nengyuan
@ 2020-05-08 10:07 ` Pan Nengyuan
2020-05-08 7:52 ` Juan Quintela
2020-05-08 10:07 ` [PATCH 2/2] migration/rdma: cleanup rdma context before g_free to avoid memleaks Pan Nengyuan
1 sibling, 1 reply; 8+ messages in thread
From: Pan Nengyuan @ 2020-05-08 10:07 UTC (permalink / raw)
To: quintela, dgilbert
Cc: zhang.zhanghailiang, Pan Nengyuan, qemu-devel, euler.robot
'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 <pannengyuan@huawei.com>
---
migration/rdma.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index 967fda5b0c..72e8b1c95b 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -4056,7 +4056,9 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
return;
err:
error_propagate(errp, local_err);
- g_free(rdma->host);
+ if (rdma) {
+ g_free(rdma->host);
+ }
g_free(rdma);
g_free(rdma_return_path);
}
--
2.18.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] migration/rdma: cleanup rdma context before g_free to avoid memleaks
2020-05-08 10:07 [PATCH 0/2] migration/rdma: fix nullptr-def in rdma_start_incoming_migration Pan Nengyuan
2020-05-08 10:07 ` [PATCH 1/2] migration/rdma: fix potential nullptr access " Pan Nengyuan
@ 2020-05-08 10:07 ` Pan Nengyuan
2020-05-08 7:54 ` Juan Quintela
2020-05-29 17:27 ` Dr. David Alan Gilbert
1 sibling, 2 replies; 8+ messages in thread
From: Pan Nengyuan @ 2020-05-08 10:07 UTC (permalink / raw)
To: quintela, dgilbert
Cc: zhang.zhanghailiang, Pan Nengyuan, qemu-devel, euler.robot
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 <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
migration/rdma.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index 72e8b1c95b..ec45d33ba3 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -4094,20 +4094,20 @@ void rdma_start_outgoing_migration(void *opaque,
rdma_return_path = qemu_rdma_data_init(host_port, errp);
if (rdma_return_path == NULL) {
- goto err;
+ goto return_path_err;
}
ret = qemu_rdma_source_init(rdma_return_path,
s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp);
if (ret) {
- goto err;
+ goto return_path_err;
}
ret = qemu_rdma_connect(rdma_return_path, errp);
if (ret) {
- goto err;
+ goto return_path_err;
}
rdma->return_path = rdma_return_path;
@@ -4120,6 +4120,8 @@ void rdma_start_outgoing_migration(void *opaque,
s->to_dst_file = qemu_fopen_rdma(rdma, "wb");
migrate_fd_connect(s, NULL);
return;
+return_path_err:
+ qemu_rdma_cleanup(rdma);
err:
g_free(rdma);
g_free(rdma_return_path);
--
2.18.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] migration/rdma: fix potential nullptr access in rdma_start_incoming_migration
2020-05-08 7:52 ` Juan Quintela
@ 2020-05-11 9:34 ` Peter Maydell
2020-05-29 17:21 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2020-05-11 9:34 UTC (permalink / raw)
To: Juan Quintela
Cc: QEMU Developers, Pan Nengyuan, zhanghailiang,
Dr. David Alan Gilbert, Euler Robot
On Fri, 8 May 2020 at 08:53, Juan Quintela <quintela@redhat.com> wrote:
>
> Pan Nengyuan <pannengyuan@huawei.com> wrote:
> > '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 <pannengyuan@huawei.com>
>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
NB: this is CID 1428762.
thanks
-- PMM
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] migration/rdma: fix potential nullptr access in rdma_start_incoming_migration
2020-05-08 7:52 ` Juan Quintela
2020-05-11 9:34 ` Peter Maydell
@ 2020-05-29 17:21 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 8+ messages in thread
From: Dr. David Alan Gilbert @ 2020-05-29 17:21 UTC (permalink / raw)
To: Juan Quintela; +Cc: zhang.zhanghailiang, Pan Nengyuan, qemu-devel, euler.robot
* Juan Quintela (quintela@redhat.com) wrote:
> Pan Nengyuan <pannengyuan@huawei.com> wrote:
> > '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 <pannengyuan@huawei.com>
>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
>
> good catch.
Thanks, Queued
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] migration/rdma: cleanup rdma context before g_free to avoid memleaks
2020-05-08 10:07 ` [PATCH 2/2] migration/rdma: cleanup rdma context before g_free to avoid memleaks Pan Nengyuan
2020-05-08 7:54 ` Juan Quintela
@ 2020-05-29 17:27 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 8+ messages in thread
From: Dr. David Alan Gilbert @ 2020-05-29 17:27 UTC (permalink / raw)
To: Pan Nengyuan; +Cc: zhang.zhanghailiang, euler.robot, qemu-devel, quintela
* Pan Nengyuan (pannengyuan@huawei.com) wrote:
> 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 <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Queued.
> ---
> migration/rdma.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/migration/rdma.c b/migration/rdma.c
> index 72e8b1c95b..ec45d33ba3 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -4094,20 +4094,20 @@ void rdma_start_outgoing_migration(void *opaque,
> rdma_return_path = qemu_rdma_data_init(host_port, errp);
>
> if (rdma_return_path == NULL) {
> - goto err;
> + goto return_path_err;
> }
>
> ret = qemu_rdma_source_init(rdma_return_path,
> s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp);
>
> if (ret) {
> - goto err;
> + goto return_path_err;
> }
>
> ret = qemu_rdma_connect(rdma_return_path, errp);
>
> if (ret) {
> - goto err;
> + goto return_path_err;
> }
>
> rdma->return_path = rdma_return_path;
> @@ -4120,6 +4120,8 @@ void rdma_start_outgoing_migration(void *opaque,
> s->to_dst_file = qemu_fopen_rdma(rdma, "wb");
> migrate_fd_connect(s, NULL);
> return;
> +return_path_err:
> + qemu_rdma_cleanup(rdma);
> err:
> g_free(rdma);
> g_free(rdma_return_path);
> --
> 2.18.2
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-05-29 17:28 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 10:07 [PATCH 0/2] migration/rdma: fix nullptr-def in rdma_start_incoming_migration Pan Nengyuan
2020-05-08 10:07 ` [PATCH 1/2] migration/rdma: fix potential nullptr access " Pan Nengyuan
2020-05-08 7:52 ` Juan Quintela
2020-05-11 9:34 ` Peter Maydell
2020-05-29 17:21 ` Dr. David Alan Gilbert
2020-05-08 10:07 ` [PATCH 2/2] migration/rdma: cleanup rdma context before g_free to avoid memleaks Pan Nengyuan
2020-05-08 7:54 ` Juan Quintela
2020-05-29 17:27 ` Dr. David Alan Gilbert
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.