* [PATCH 0/1] migration: free migration blocker error in migrate_del_blocker() stub
@ 2026-11-11 12:27 Zhu Wei
2026-11-11 12:27 ` [PATCH 1/1] " Zhu Wei
0 siblings, 1 reply; 4+ messages in thread
From: Zhu Wei @ 2026-11-11 12:27 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Peter Xu, Fabiano Rosas, zhuwei, zachwade . k
From: zhuwei <zhuwei@sangfor.com.cn>
Hi,
The migrate_del_blocker() implementation in stubs/migr-blocker.c was an
empty no-op, while the real one in migration/migration.c takes ownership
of the Error from the migration blocker, frees it and then clears the
pointer:
void migrate_del_blocker(Error **reasonp)
{
if (*reasonp) {
...
error_free(*reasonp);
*reasonp = NULL;
}
}
Command-line tools such as qemu-img link against the stub API. Block
drivers like vmdk allocate a migration blocker Error during open() (see
error_setg() in vmdk_open(), "does not support live migration") and pass
it to migrate_add_blocker_normal(). Because the stub
migrate_add_blocker*() is a no-op it does not take ownership of the
Error, so on close the stub migrate_del_blocker() has to free it itself;
leaving the body empty leaks the error message.
This becomes visible when running under ASan: "qemu-img info foo.vmdk"
leaks the migration-blocker error and hangs / fails to exit when the
image is closed.
This patch frees the Error in the stub migrate_del_blocker() and sets
the pointer to NULL to match the semantics of the real implementation.
This also covers every other driver that uses a migration blocker
through the stub.
Thanks,
zhuwei
---
stubs/migr-blocker.c | 7 +++++++
1 file changed, 7 insertions(+)
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/1] migration: free migration blocker error in migrate_del_blocker() stub
2026-11-11 12:27 [PATCH 0/1] migration: free migration blocker error in migrate_del_blocker() stub Zhu Wei
@ 2026-11-11 12:27 ` Zhu Wei
2026-11-16 18:19 ` Fabiano Rosas
0 siblings, 1 reply; 4+ messages in thread
From: Zhu Wei @ 2026-11-11 12:27 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Peter Xu, Fabiano Rosas, zhuwei, zachwade . k
From: niming <niming@sangfor.com.cn>
The migrate_del_blocker() implementation in stubs/migr-blocker.c was an
empty no-op, while the real one in migration/migration.c takes ownership
of the Error from the migration blocker, frees it and then clears the
pointer:
void migrate_del_blocker(Error **reasonp)
{
if (*reasonp) {
...
error_free(*reasonp);
*reasonp = NULL;
}
}
Command line tools such as qemu-img link against the stub API. Block
drivers like vmdk allocate a migration blocker Error during open() (see
error_setg() in vmdk_open(), "does not support live migration") and pass
it to migrate_add_blocker_normal(). Because the stub migrate_add_blocker*()
is a no-op it does not take ownership of the Error, so on close the
stub migrate_del_blocker() has to free it itself; leaving the body empty
leaks the error message.
This becomes visible when running under ASan: "qemu-img info foo.vmdk"
leaks the migration-blocker error and hangs / fails to exit when the
image is closed.
Free the Error in the stub migrate_del_blocker() and set the pointer to
NULL to match the semantics of the real implementation. This also covers
every other driver that uses a migration blocker through the stub.
Signed-off-by: niming <niming@sangfor.com.cn>
Signed-off-by: zhuwei <zhuwei@sangfor.com.cn>
---
stubs/migr-blocker.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/stubs/migr-blocker.c b/stubs/migr-blocker.c
index e54c7160d3..575b65f183 100644
--- a/stubs/migr-blocker.c
+++ b/stubs/migr-blocker.c
@@ -1,5 +1,6 @@
#include "qemu/osdep.h"
#include "migration/blocker.h"
+#include "qapi/error.h"
int migrate_add_blocker(Error **reasonp, Error **errp)
{
@@ -18,4 +19,12 @@ int migrate_add_blocker_modes(Error **reasonp, unsigned modes, Error **errp)
void migrate_del_blocker(Error **reasonp)
{
+ /*
+ * migrate_add_blocker*() is a no-op here, so nobody owns the Error;
+ * free it to avoid a leak (e.g. "qemu-img info foo.vmdk").
+ */
+ if (reasonp && *reasonp) {
+ error_free(*reasonp);
+ *reasonp = NULL;
+ }
}
--
2.56.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] migration: free migration blocker error in migrate_del_blocker() stub
2026-11-11 12:27 ` [PATCH 1/1] " Zhu Wei
@ 2026-11-16 18:19 ` Fabiano Rosas
0 siblings, 0 replies; 4+ messages in thread
From: Fabiano Rosas @ 2026-11-16 18:19 UTC (permalink / raw)
To: Zhu Wei, qemu-devel; +Cc: Paolo Bonzini, Peter Xu, zhuwei, zachwade . k
Zhu Wei <zhuwei@sangfor.com.cn> writes:
> From: niming <niming@sangfor.com.cn>
>
> The migrate_del_blocker() implementation in stubs/migr-blocker.c was an
> empty no-op, while the real one in migration/migration.c takes ownership
> of the Error from the migration blocker, frees it and then clears the
> pointer:
>
> void migrate_del_blocker(Error **reasonp)
> {
> if (*reasonp) {
> ...
> error_free(*reasonp);
> *reasonp = NULL;
> }
> }
>
> Command line tools such as qemu-img link against the stub API. Block
> drivers like vmdk allocate a migration blocker Error during open() (see
> error_setg() in vmdk_open(), "does not support live migration") and pass
> it to migrate_add_blocker_normal(). Because the stub migrate_add_blocker*()
> is a no-op it does not take ownership of the Error, so on close the
> stub migrate_del_blocker() has to free it itself; leaving the body empty
> leaks the error message.
>
> This becomes visible when running under ASan: "qemu-img info foo.vmdk"
> leaks the migration-blocker error and hangs / fails to exit when the
> image is closed.
>
> Free the Error in the stub migrate_del_blocker() and set the pointer to
> NULL to match the semantics of the real implementation. This also covers
> every other driver that uses a migration blocker through the stub.
>
> Signed-off-by: niming <niming@sangfor.com.cn>
> Signed-off-by: zhuwei <zhuwei@sangfor.com.cn>
> ---
> stubs/migr-blocker.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/stubs/migr-blocker.c b/stubs/migr-blocker.c
> index e54c7160d3..575b65f183 100644
> --- a/stubs/migr-blocker.c
> +++ b/stubs/migr-blocker.c
> @@ -1,5 +1,6 @@
> #include "qemu/osdep.h"
> #include "migration/blocker.h"
> +#include "qapi/error.h"
>
> int migrate_add_blocker(Error **reasonp, Error **errp)
> {
> @@ -18,4 +19,12 @@ int migrate_add_blocker_modes(Error **reasonp, unsigned modes, Error **errp)
>
> void migrate_del_blocker(Error **reasonp)
> {
> + /*
> + * migrate_add_blocker*() is a no-op here, so nobody owns the Error;
> + * free it to avoid a leak (e.g. "qemu-img info foo.vmdk").
> + */
> + if (reasonp && *reasonp) {
> + error_free(*reasonp);
> + *reasonp = NULL;
> + }
> }
Reviewed-by: Fabiano Rosas <farosas@suse.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 0/1] migration: free migration blocker error in migrate_del_blocker() stub
@ 2026-11-13 15:11 Zhu Wei
2026-11-13 15:11 ` [PATCH 1/1] " Zhu Wei
0 siblings, 1 reply; 4+ messages in thread
From: Zhu Wei @ 2026-11-13 15:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Peter Xu, Fabiano Rosas, zhuwei, zachwade . k
From: zhuwei <zhuwei@sangfor.com.cn>
Hi,
The migrate_del_blocker() implementation in stubs/migr-blocker.c was an
empty no-op, while the real one in migration/migration.c takes ownership
of the Error from the migration blocker, frees it and then clears the
pointer:
void migrate_del_blocker(Error **reasonp)
{
if (*reasonp) {
...
error_free(*reasonp);
*reasonp = NULL;
}
}
Command-line tools such as qemu-img link against the stub API. Block
drivers like vmdk allocate a migration blocker Error during open() (see
error_setg() in vmdk_open(), "does not support live migration") and pass
it to migrate_add_blocker_normal(). Because the stub
migrate_add_blocker*() is a no-op it does not take ownership of the
Error, so on close the stub migrate_del_blocker() has to free it itself;
leaving the body empty leaks the error message.
This becomes visible when running under ASan: "qemu-img info foo.vmdk"
leaks the migration-blocker error and hangs / fails to exit when the
image is closed.
This patch frees the Error in the stub migrate_del_blocker() and sets
the pointer to NULL to match the semantics of the real implementation.
This also covers every other driver that uses a migration blocker
through the stub.
Thanks,
zhuwei
---
stubs/migr-blocker.c | 7 +++++++
1 file changed, 7 insertions(+)
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/1] migration: free migration blocker error in migrate_del_blocker() stub
2026-11-13 15:11 [PATCH 0/1] " Zhu Wei
@ 2026-11-13 15:11 ` Zhu Wei
0 siblings, 0 replies; 4+ messages in thread
From: Zhu Wei @ 2026-11-13 15:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Peter Xu, Fabiano Rosas, zhuwei, zachwade . k
From: niming <niming@sangfor.com.cn>
The migrate_del_blocker() implementation in stubs/migr-blocker.c was an
empty no-op, while the real one in migration/migration.c takes ownership
of the Error from the migration blocker, frees it and then clears the
pointer:
void migrate_del_blocker(Error **reasonp)
{
if (*reasonp) {
...
error_free(*reasonp);
*reasonp = NULL;
}
}
Command line tools such as qemu-img link against the stub API. Block
drivers like vmdk allocate a migration blocker Error during open() (see
error_setg() in vmdk_open(), "does not support live migration") and pass
it to migrate_add_blocker_normal(). Because the stub migrate_add_blocker*()
is a no-op it does not take ownership of the Error, so on close the
stub migrate_del_blocker() has to free it itself; leaving the body empty
leaks the error message.
This becomes visible when running under ASan: "qemu-img info foo.vmdk"
leaks the migration-blocker error and hangs / fails to exit when the
image is closed.
Free the Error in the stub migrate_del_blocker() and set the pointer to
NULL to match the semantics of the real implementation. This also covers
every other driver that uses a migration blocker through the stub.
Signed-off-by: niming <niming@sangfor.com.cn>
Signed-off-by: zhuwei <zhuwei@sangfor.com.cn>
---
stubs/migr-blocker.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/stubs/migr-blocker.c b/stubs/migr-blocker.c
index e54c7160d3..575b65f183 100644
--- a/stubs/migr-blocker.c
+++ b/stubs/migr-blocker.c
@@ -1,5 +1,6 @@
#include "qemu/osdep.h"
#include "migration/blocker.h"
+#include "qapi/error.h"
int migrate_add_blocker(Error **reasonp, Error **errp)
{
@@ -18,4 +19,12 @@ int migrate_add_blocker_modes(Error **reasonp, unsigned modes, Error **errp)
void migrate_del_blocker(Error **reasonp)
{
+ /*
+ * migrate_add_blocker*() is a no-op here, so nobody owns the Error;
+ * free it to avoid a leak (e.g. "qemu-img info foo.vmdk").
+ */
+ if (reasonp && *reasonp) {
+ error_free(*reasonp);
+ *reasonp = NULL;
+ }
}
--
2.56.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-16 18:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-11 12:27 [PATCH 0/1] migration: free migration blocker error in migrate_del_blocker() stub Zhu Wei
2026-11-11 12:27 ` [PATCH 1/1] " Zhu Wei
2026-11-16 18:19 ` Fabiano Rosas
-- strict thread matches above, loose matches on Subject: below --
2026-11-13 15:11 [PATCH 0/1] " Zhu Wei
2026-11-13 15:11 ` [PATCH 1/1] " Zhu Wei
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.