[libvirt] [PATCH] lxc: Avoid segfault of libvirt_lxc helper on early cleanup paths

Early jumps to the cleanup label caused a crash of the libvirt_lxc container helper as the cleanup section called virLXCControllerDeleteInterfaces(ctrl) without checking the ctrl argument for NULL. The argument was de-referenced soon after. $ /usr/libexec/libvirt_lxc /usr/libexec/libvirt_lxc: missing --name argument for configuration Segmentation fault --- src/lxc/lxc_controller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index a9d2d40..ea5bc58 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -1672,7 +1672,8 @@ int main(int argc, char *argv[]) cleanup: virPidFileDelete(LXC_STATE_DIR, name); - virLXCControllerDeleteInterfaces(ctrl); + if (ctrl) + virLXCControllerDeleteInterfaces(ctrl); for (i = 0 ; i < nttyFDs ; i++) VIR_FORCE_CLOSE(ttyFDs[i]); VIR_FREE(ttyFDs); -- 1.8.0

On Mon, Nov 26, 2012 at 12:18:17 +0100, Peter Krempa wrote:
Early jumps to the cleanup label caused a crash of the libvirt_lxc container helper as the cleanup section called virLXCControllerDeleteInterfaces(ctrl) without checking the ctrl argument for NULL. The argument was de-referenced soon after.
$ /usr/libexec/libvirt_lxc /usr/libexec/libvirt_lxc: missing --name argument for configuration Segmentation fault --- src/lxc/lxc_controller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ACK Jirka

On 11/26/12 15:35, Jiri Denemark wrote:
On Mon, Nov 26, 2012 at 12:18:17 +0100, Peter Krempa wrote:
Early jumps to the cleanup label caused a crash of the libvirt_lxc container helper as the cleanup section called virLXCControllerDeleteInterfaces(ctrl) without checking the ctrl argument for NULL. The argument was de-referenced soon after.
$ /usr/libexec/libvirt_lxc /usr/libexec/libvirt_lxc: missing --name argument for configuration Segmentation fault --- src/lxc/lxc_controller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ACK
Jirka
Pushed, thanks. Peter
participants (2)
-
Jiri Denemark
-
Peter Krempa