From: kaf24@firebug.cl.cam.ac.uk Date: Fri, 13 Jan 2006 14:22:36 +0000 (+0100) Subject: Fix xenbus_cleanup_devices() to cleanup proper subdirectories X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16541^2~46 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=723bbd528ff0bcfb7c8dda05486aa69fbf0080f3;p=xen.git Fix xenbus_cleanup_devices() to cleanup proper subdirectories of the deleted path, not merely paths mwith matching prefixes. Signed-off-by: Keir Fraser --- diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index 7b267836da..6fbe1e3649 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -470,12 +470,17 @@ static int cleanup_dev(struct device *dev, void *data) 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)