Mailing List Archive

Fix xenbus_cleanup_devices() to cleanup proper subdirectories
# HG changeset patch
# User kaf24@firebug.cl.cam.ac.uk
# Node ID e888f9b28a5b9dd2e19326f32b483e1c084704ec
# Parent 956bf08c91c36e6734d9c38d2e481732c976d32b
Fix xenbus_cleanup_devices() to cleanup proper subdirectories
of the deleted path, not merely paths mwith matching prefixes.

Signed-off-by: Keir Fraser <keir@xensource.com>

diff -r 956bf08c91c3 -r e888f9b28a5b linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Fri Jan 13 14:09:39 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Fri Jan 13 14:22:36 2006
@@ -470,12 +470,17 @@

DPRINTK("%s", info->nodename);

- if (!strncmp(xendev->nodename, info->nodename, len)) {
- info->dev = xendev;
- get_device(dev);
- return 1;
- }
- return 0;
+ /* Match the info->nodename path, or any subdirectory of that path. */
+ if (strncmp(xendev->nodename, info->nodename, len))
+ return 0;
+
+ /* If the node name is longer, ensure it really is a subdirectory. */
+ if ((strlen(xendev->nodename) > len) && (xendev->nodename[len] != '/'))
+ return 0;
+
+ info->dev = xendev;
+ get_device(dev);
+ return 1;
}

static void xenbus_cleanup_devices(const char *path, struct bus_type *bus)

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