]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
tools/xenstored: Avoid dereferencing a NULL pointer if LiveUpdate is failing
authorJulien Grall <jgrall@amazon.com>
Fri, 26 Feb 2021 18:26:55 +0000 (18:26 +0000)
committerJulien Grall <jgrall@amazon.com>
Tue, 2 Mar 2021 09:42:21 +0000 (09:42 +0000)
In case of failure in do_lu_start(), XenStored will first free lu_start
and then try to dereference it.

This will result to a NULL dereference as the destruction callback will
set lu_start to NULL.

The crash can be avoided by freeing lu_start *after* the reply has been
set.

Fixes: af216a99fb4a ("tools/xenstore: add the basic framework for doing the live update")
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
tools/xenstore/xenstored_control.c

index 653890f2d9e08668cc54a98b1a41159e8c58cfa7..766b2438396afca4d85c9eb339c78dd75c79ecfe 100644 (file)
@@ -657,9 +657,8 @@ static bool do_lu_start(struct delayed_request *req)
 
        /* We will reach this point only in case of failure. */
  out:
-       talloc_free(lu_status);
-
        send_reply(lu_status->conn, XS_CONTROL, ret, strlen(ret) + 1);
+       talloc_free(lu_status);
 
        return true;
 }