summary refs log tree commit diff stats
path: root/authz/listfile.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-11-13 07:23:57 +0100
committerDaniel P. Berrangé <berrange@redhat.com>2020-11-18 10:51:35 +0000
commit2b37e9f84372b5c98ef0ba114ce016953e47bc3c (patch)
treed75ad8bdebc971178de1c91a5dbe26db6c6a11ae /authz/listfile.c
parent66a300a107ec286725bdc943601cbd4247b82158 (diff)
downloadfocaccia-qemu-2b37e9f84372b5c98ef0ba114ce016953e47bc3c.tar.gz
focaccia-qemu-2b37e9f84372b5c98ef0ba114ce016953e47bc3c.zip
authz-list-file: Fix file read error handling
The Error ** argument must be NULL, &error_abort, &error_fatal, or a
pointer to a variable containing NULL.  Passing an argument of the
latter kind twice without clearing it in between is wrong: if the
first call sets an error, it no longer points to NULL for the second
call.

qauthz_list_file_complete() is wrong that way: it passes @errp to
qauthz_list_file_complete() without checking for failure.  If it runs
into another failure, it trips error_setv()'s assertion.  Reproducer:

    $ qemu-system-x86_64 -nodefaults -S -display none -object authz-list-file,id=authz0,filename=
    qemu-system-x86_64: ../util/error.c:59: error_setv: Assertion `*errp == NULL' failed.
    Aborted (core dumped)

Fix it to check for failure.

Fixes: 55d869846de802a16af1a50584c51737bd664387
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'authz/listfile.c')
-rw-r--r--authz/listfile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/authz/listfile.c b/authz/listfile.c
index 24feac35ab..1421e674a4 100644
--- a/authz/listfile.c
+++ b/authz/listfile.c
@@ -128,6 +128,9 @@ qauthz_list_file_complete(UserCreatable *uc, Error **errp)
     }
 
     fauthz->list = qauthz_list_file_load(fauthz, errp);
+    if (!fauthz->list) {
+        return;
+    }
 
     if (!fauthz->refresh) {
         return;