• R
    nodedev_hal: fix segfault when virDBusGetSystemBus fails · 87176d0c
    Ryota Ozaki 提交于
    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: NRyota Ozaki <ozaki.ryota@gmail.com>
    87176d0c
node_device_hal.c 23.9 KB