Am 25.05.2011 00:18 schrieb Greg KH: > On Wed, May 25, 2011 at 12:02:48AM +0200, Carl-Daniel Hailfinger wrote: > >> I was playing with the "authorized" attribute of USB devices in >> sysfs. >> If at least one device has authorized=0, >> "lsusb" will print nothing (not even the host controllers) >> > Well, if the device can't be accessed, as you disabled it through the > authorised=0 setting, lsusb shouldn't really be able to do much with it. > Turns out there are two bugs: libusb screws up walking the bus and claims there are -1 devices (error). lsusb ignores that and tries to free a nonexisting object. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@xxxxxxx> diff --git a/lsusb.c b/lsusb.c index 6ba2288..edcc864 100644 --- a/lsusb.c +++ b/lsusb.c @@ -3861,6 +3861,8 @@ static int list_devices(libusb_context *ctx, int busnum, int devnum, int vendori status = 1; /* 1 device not found, 0 device found */ num_devs = libusb_get_device_list(ctx, &list); + if (num_devs < 0) + goto error; for (i = 0; i < num_devs; ++i) { libusb_device *dev = list[i]; @@ -3890,6 +3892,7 @@ static int list_devices(libusb_context *ctx, int busnum, int devnum, int vendori } libusb_free_device_list(list, 0); +error: return status; } -- http://www.hailfinger.org/ -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html