Skip to content

Commit

Permalink
tools/xenstored: Avoid dereferencing a NULL pointer if LiveUpdate is …
Browse files Browse the repository at this point in the history
…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: af216a9 ("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>
  • Loading branch information
Julien Grall committed Mar 2, 2021
1 parent 6b4d4dd commit 29fae90
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tools/xenstore/xenstored_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 29fae90

Please sign in to comment.