Skip to content
Snippets Groups Projects
Commit e5ae24b1 authored by Guido Günther's avatar Guido Günther
Browse files

Fix on udev backend startup

parent c5abc2e9
No related branches found
No related tags found
No related merge requests found
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Mon, 7 Dec 2009 19:00:11 +0100
Subject: [PATCH] udev_device_get_devpath might return NULL
Fix crash on strdup in that case.
---
src/node_device/node_device_udev.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 9b48052..c7238fc 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -947,8 +947,14 @@ static int udevProcessStorage(struct udev_device *device,
{
union _virNodeDevCapData *data = &def->caps->data;
int ret = -1;
+ const char* devnode;
- data->storage.block = strdup(udev_device_get_devnode(device));
+ devnode = udev_device_get_devnode(device);
+ if(!devnode) {
+ VIR_DEBUG("No devnode for '%s'\n", udev_device_get_devpath(device));
+ goto out;
+ }
+ data->storage.block = strdup(devnode);
if (udevGetStringProperty(device,
"DEVNAME",
&data->storage.block) == PROPERTY_ERROR) {
--
......@@ -2,3 +2,4 @@
0002-qemu-disable-network.diff.patch
0003-allow-libvirt-group-to-access-the-socket.patch
0004-fix-Debian-specific-path-to-hvm-loader.patch
0005-udev_device_get_devpath-might-return-NULL.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment