[libvirt] [PATCH] nodedev_hal: fix segfault when virDBusGetSystemBus fails
Eric Blake
eblake at redhat.com
Thu Oct 31 17:24:51 UTC 2013
On 10/31/2013 09:45 AM, Ryota Ozaki wrote:
> 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 at gmail.com>
> ---
> src/node_device/node_device_hal.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
ACK and pushed.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131031/22e7f50a/attachment-0001.sig>
More information about the libvir-list
mailing list