tools/xenstored: Avoid dereferencing a NULL pointer if LiveUpdate is failing
PATCH 1/1 tools/xenstored: Avoid dereferencing a NULL pointer if LiveUpdate is failing
From: Julien Grall <[email protected]>
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.
---
This is a bug fix candidate for 4.15. The easiest way to trigger it is to have a XTF test that starts a transaction but never terminates it.
In this case, live-updating would fail and trigger a crash.
--- tools/xenstore/xenstored_control.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/xenstore/xenstored_control.c +1 -2
@@ -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; }
Signature · 1 line
2.17.1
Julien Grall writes ("[PATCH for-4.15] tools/xenstored: Avoid dereferencing a NULL pointer if LiveUpdate is failing"):
Quoted 5 lines
From: Julien Grall <[email protected]>
In case of failure in
do_lu_start(), XenStored will first freelu_startand then try to dereference it.
Quoted 8 lines
This will result to a NULL dereference as the destruction callback will set
lu_startto 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 <[email protected]>
Quoted 5 lines · Julien Grall
From: Julien Grall <[email protected]>
In case of failure in
do_lu_start(), XenStored will first freelu_startand then try to dereference it.
Quoted 8 lines
This will result to a NULL dereference as the destruction callback will set
lu_startto 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 <[email protected]>
Juergen
Hi Juergen,
Quoted 9 lines · Jürgen Groß
Quoted 8 lines · Julien Grall
From: Julien Grall <[email protected]>
In case of failure in
do_lu_start(), XenStored will first freelu_startand then try to dereference it.This will result to a NULL dereference as the destruction callback will set
lu_startto NULL.
Quoted 7 lines
Quoted 5 lines
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 <[email protected]>Reviewed-by Juergen Gross <[email protected]>
Thanks! I have committed the patch.
Cheers,
Signature · 1 line
Julien Grall