libvirt/src/node_device
Ryota Ozaki 87176d0ce9 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>
2013-10-31 11:21:10 -06:00
..
node_device_driver.c Convert 'int i' to 'size_t i' in src/node_device/ files 2013-07-10 17:55:16 +01:00
node_device_driver.h node_device: Clean up unused macros 2013-05-13 18:29:02 +08:00
node_device_hal.c nodedev_hal: fix segfault when virDBusGetSystemBus fails 2013-10-31 11:21:10 -06:00
node_device_hal.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
node_device_linux_sysfs.c nodedev: fix vport detection for FC HBA 2013-06-12 11:08:45 +02:00
node_device_udev.c Stop free'ing 'const char *' strings 2013-09-05 11:28:01 +01:00
node_device_udev.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00