of the deleted path, not merely paths mwith matching prefixes.
Signed-off-by: Keir Fraser <keir@xensource.com>
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)