[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] libxl: fail to parse disk vpath if a disk+part number is required but unavailable



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1310646155 -3600
# Node ID 2f14754868462d173a46d47c710db01aecedd3f4
# Parent  725f44036b337a464866b3762d1136702ee05473
libxl: fail to parse disk vpath if a disk+part number is required but 
unavailable

libxl__device_disk_dev_number() can parse a virtpath which is an encoded
unsigned long but does not set *pdisk or *ppartition in that case.

Ideally we would parse the number but for now simply fail to prevent cascading
failures.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 725f44036b33 -r 2f1475486846 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Thu Jul 14 13:22:35 2011 +0100
+++ b/tools/libxl/libxl_device.c        Thu Jul 14 13:22:35 2011 +0100
@@ -341,8 +341,12 @@ int libxl__device_disk_dev_number(const 
 
     errno = 0;
     ul = strtoul(virtpath, &ep, 0);
-    if (!errno && !*ep && ul <= INT_MAX)
+    if (!errno && !*ep && ul <= INT_MAX) {
+        /* FIXME: should parse ul to determine these. */
+        if (pdisk || ppartition)
+            return -1;
         return ul;
+    }
 
     if (device_virtdisk_matches(virtpath, "hd",
                                 &disk, 3,

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.