aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Ivanov <alexander.ivanov@virtuozzo.com>2024-08-09 14:13:40 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2024-09-12 09:20:33 +0300
commitf4e8d980fce9cbbf54313d41c65b63cc1c7a0e49 (patch)
treecf829c81c05e4e6c1d26060ca7545baf6b8f7ad5
parent6effd6ad72981605a6c7016910c27c226a9ace89 (diff)
module: Prevent crash by resetting local_err in module_load_qom_all()
Set local_err to NULL after it has been freed in error_report_err(). This avoids triggering assert(*errp == NULL) failure in error_setv() when local_err is reused in the loop. Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com> Reviewed-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Denis V. Lunev <den@openvz.org> Link: https://lore.kernel.org/r/20240809121340.992049-2-alexander.ivanov@virtuozzo.com [Do the same by moving the declaration instead. - Paolo] Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 940d802b24e63650e0eacad3714e2ce171cba17c) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--util/module.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/module.c b/util/module.c
index 32e263163c..3eb0f06df1 100644
--- a/util/module.c
+++ b/util/module.c
@@ -354,13 +354,13 @@ int module_load_qom(const char *type, Error **errp)
void module_load_qom_all(void)
{
const QemuModinfo *modinfo;
- Error *local_err = NULL;
if (module_loaded_qom_all) {
return;
}
for (modinfo = module_info; modinfo->name != NULL; modinfo++) {
+ Error *local_err = NULL;
if (!modinfo->objs) {
continue;
}