tools/xenstored: Avoid dereferencing a NULL pointer if LiveUpdate is failing

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: af216a99fb ("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>
This commit is contained in:
Julien Grall committed 2021-03-02 09:42:21 +00:00
1 parent 6b4d4dd384
commit 29fae90baa
1 file changed
+1 -2
+1 -2
View 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;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.