Skip to contentSkip to conversation

: xl, fix segfault when detaching non-existant disk

PATCH In review Gianni Tedesco 2 participants 3 messages Jul 26, 2010 – Jul 27, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : xl, fix segfault when detaching non-existant disk

tools/libxl/libxl_utils.c +2 -0
diff -r ac7e4c6ec6c7 tools/libxl/libxl_utils.c
@@ -451,6 +451,8 @@ int libxl_devid_to_device_disk(struct li
     }
 
     val = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/backend-id", diskpath));
+    if (!val)
+        return ERROR_FAIL;
     disk->backend_domid = strtoul(val, NULL, 10);
     disk->domid = domid;
     be_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/backend", diskpath));
#1 lore raw

Gianni Tedesco (3P) writes ("[PATCH]: xl, fix segfault when detaching non-existant disk"):

tools/libxl/libxl_utils.c int libxl_devid_to_device_disk(struct li · line 455

Quoted 3 lines
     val = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/backend-id", diskpath));
tools/libxl/libxl_utils.c +2 -0
+    if (!val)
+        return ERROR_FAIL;

This is fine as far as it goes, and I'll apply it, but would you like to do the same for all the other unchecked libxl_xs_read calls ? :-)

Ian.

#2 lore raw
Quoted 7 lines · Ian Jackson

Gianni Tedesco (3P) writes ("[PATCH]: xl, fix segfault when detaching non-existant disk"):

tools/libxl/libxl_utils.c int libxl_devid_to_device_disk(struct li · line 455

Quoted 3 lines
     val = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/backend-id", diskpath));
tools/libxl/libxl_utils.c +2 -0
+    if (!val)
+        return ERROR_FAIL;

This is fine as far as it goes, and I'll apply it, but would you like to do the same for all the other unchecked libxl_xs_read calls ? :-)

It's a gigantic piece of work, along with sorting out various memory leaks. It is on my TODO list :)

Gianni