Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usbip: list: don't list devices attached to vhci_hcd

usbip host lists devices attached to vhci_hcd on the same server
when user does attach over localhost or specifies the server as the
remote.

usbip attach -r localhost -b busid
or
usbip attach -r servername (or server IP)

Fix it to check and not list devices that are attached to vhci_hcd.

Cc: stable@vger.kernel.org
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Shuah Khan and committed by
Greg Kroah-Hartman
ef824501 ef54cf0c

+9
+9
tools/usb/usbip/src/usbip_list.c
··· 187 187 const char *busid; 188 188 char product_name[128]; 189 189 int ret = -1; 190 + const char *devpath; 190 191 191 192 /* Create libudev context. */ 192 193 udev = udev_new(); ··· 209 208 udev_list_entry_foreach(dev_list_entry, devices) { 210 209 path = udev_list_entry_get_name(dev_list_entry); 211 210 dev = udev_device_new_from_syspath(udev, path); 211 + 212 + /* Ignore devices attached to vhci_hcd */ 213 + devpath = udev_device_get_devpath(dev); 214 + if (strstr(devpath, USBIP_VHCI_DRV_NAME)) { 215 + dbg("Skip the device %s already attached to %s\n", 216 + devpath, USBIP_VHCI_DRV_NAME); 217 + continue; 218 + } 212 219 213 220 /* Get device information. */ 214 221 idVendor = udev_device_get_sysattr_value(dev, "idVendor");