]> git.ipfire.org Git - thirdparty/libvirt.git/commit
nodedev_hal: fix segfault when virDBusGetSystemBus fails v1.1.4-rc2
authorRyota Ozaki <ozaki.ryota@gmail.com>
Thu, 31 Oct 2013 15:45:12 +0000 (00:45 +0900)
committerEric Blake <eblake@redhat.com>
Thu, 31 Oct 2013 17:21:10 +0000 (11:21 -0600)
commit87176d0ce95bfdf2091c93cc30f44687be481185
tree6aad60ad24b58cc60e6bbb55f4d710f9687e7dfe
parent4b9862775c252b5a7a744678c891dac8329d4720
nodedev_hal: fix segfault when virDBusGetSystemBus fails

Thie patch fixes the segfault:
    error : nodeStateInitialize:658 : DBus not available,
      disabling HAL driver: internal error: Unable to get DBus
      system bus connection: Failed to connect to socket
      /var/run/dbus/system_bus_socket: No such file or directory
    error : nodeStateInitialize:719 :  ?:
    Caught Segmentation violation dumping internal log buffer:

This segfault occurs at the below VIR_ERROR:
  failure:
      if (dbus_error_is_set(&err)) {
          VIR_ERROR(_("%s: %s"), err.name, err.message);

When virDBusGetSystemBus fails, the code jumps to the above failure
path. However, the err variable is not correctly initialized
before calling virDBusGetSystemBus. As a result, dbus_error_is_set
may pass over the uninitialized err variable whose name or
message may point to somewhere unknown memory region, which
causes a segfault on VIR_ERROR.

The new code initializes the err variable before calling
virDBusGetSystemBus.

Signed-off-by: Ryota Ozaki <ozaki.ryota@gmail.com>
src/node_device/node_device_hal.c