ia64/xen-unstable

changeset 8592:e888f9b28a5b

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>
author kaf24@firebug.cl.cam.ac.uk
date Fri Jan 13 15:22:36 2006 +0100 (2006-01-13)
parents 956bf08c91c3
children 903420e4d449
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Fri Jan 13 14:09:39 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Fri Jan 13 15:22:36 2006 +0100
     1.3 @@ -470,12 +470,17 @@ static int cleanup_dev(struct device *de
     1.4  
     1.5  	DPRINTK("%s", info->nodename);
     1.6  
     1.7 -	if (!strncmp(xendev->nodename, info->nodename, len)) {
     1.8 -		info->dev = xendev;
     1.9 -		get_device(dev);
    1.10 -		return 1;
    1.11 -	}
    1.12 -	return 0;
    1.13 +	/* Match the info->nodename path, or any subdirectory of that path. */
    1.14 +	if (strncmp(xendev->nodename, info->nodename, len))
    1.15 +		return 0;
    1.16 +
    1.17 +	/* If the node name is longer, ensure it really is a subdirectory. */
    1.18 +	if ((strlen(xendev->nodename) > len) && (xendev->nodename[len] != '/'))
    1.19 +		return 0;
    1.20 +
    1.21 +	info->dev = xendev;
    1.22 +	get_device(dev);
    1.23 +	return 1;
    1.24  }
    1.25  
    1.26  static void xenbus_cleanup_devices(const char *path, struct bus_type *bus)