libxenctrl: Fix xc_interface_close() crash if it gets NULL as an argument
PATCH 1/1 libxenctrl: Fix xc_interface_close() crash if it gets NULL as an argument
xc_interface_close() crashes if it gets NULL as an argument. However, it just calls xc_interface_close_common() which is called by many others functions. It means that they are also vulnerable. So fix above mentioned issue by adding NULL check in xc_interface_close_common(). This way we fix similar issue in other functions which calls xc_interface_close_common() too.
--- tools/libxc/xc_private.c | 3 +++ 1 file changed, 3 insertions(+)
tools/libxc/xc_private.c +3 -0
@@ -198,6 +198,9 @@ static int xc_interface_close_common(xc_interface *xch) {int rc =0 ; +if (!xch) +return 0 ; +xc__hypercall_buffer_cache_release (xch);xtl_logger_destroy (xch->dombuild_logger_tofree);
Signature · 1 line
1.7.10.4
Quoted 8 lines · Daniel Kiper
xc_interface_close()crashes if it gets NULL as an argument. However, it just callsxc_interface_close_common()which is called by many others functions. It means that they are also vulnerable. So fix above mentioned issue by adding NULL check inxc_interface_close_common(). This way we fix similar issue in other functions which callsxc_interface_close_common()too.Signed-off-by Daniel Kiper <[email protected]>
I suppose this makes sense in the same way that free(NULL) does:
Did you observe this with a particular caller?
Quoted 8 lines · Ian Campbell
Quoted 7 lines · Daniel Kiper
xc_interface_close()crashes if it gets NULL as an argument. However, it just callsxc_interface_close_common()which is called by many others functions. It means that they are also vulnerable. So fix above mentioned issue by adding NULL check inxc_interface_close_common(). This way we fix similar issue in other functions which callsxc_interface_close_common()too.
Quoted 4 lines
Quoted 1 line
Signed-off-by Daniel Kiper <[email protected]>I suppose this makes sense in the same way that free(NULL) does:
Acked-by Ian Campbell <[email protected]>
Thanks.
Quoted 1 line
Did you observe this with a particular caller?
Yes, I found this issue by chance in kaxec-tools. It is fixed right now but I agree that this type of functions should behave with NULL like free(NULL).
Daniel
Quoted 9 lines · Daniel Kiper
Quoted 8 lines · Ian Campbell
Quoted 7 lines · Daniel Kiper
xc_interface_close()crashes if it gets NULL as an argument. However, it just callsxc_interface_close_common()which is called by many others functions. It means that they are also vulnerable. So fix above mentioned issue by adding NULL check inxc_interface_close_common(). This way we fix similar issue in other functions which callsxc_interface_close_common()too.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Daniel Kiper <[email protected]>I suppose this makes sense in the same way that free(NULL) does:
Acked-by Ian Campbell <[email protected]>Thanks.
And now applied.
Quoted 3 lines
Quoted 1 line
Did you observe this with a particular caller?
Yes, I found this issue by chance in kaxec-tools. It is fixed
Great, thanks.
Quoted 4 lines
right now but I agree that this type of functions should behave with NULL like free(NULL).
Daniel