diff options
Diffstat (limited to 'tools/usb/usbip/src/usbip_bind.c')
-rw-r--r-- | tools/usb/usbip/src/usbip_bind.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/usb/usbip/src/usbip_bind.c b/tools/usb/usbip/src/usbip_bind.c index fa46141ae68b..e121cfb1746a 100644 --- a/tools/usb/usbip/src/usbip_bind.c +++ b/tools/usb/usbip/src/usbip_bind.c | |||
@@ -144,6 +144,7 @@ static int bind_device(char *busid) | |||
144 | int rc; | 144 | int rc; |
145 | struct udev *udev; | 145 | struct udev *udev; |
146 | struct udev_device *dev; | 146 | struct udev_device *dev; |
147 | const char *devpath; | ||
147 | 148 | ||
148 | /* Check whether the device with this bus ID exists. */ | 149 | /* Check whether the device with this bus ID exists. */ |
149 | udev = udev_new(); | 150 | udev = udev_new(); |
@@ -152,8 +153,16 @@ static int bind_device(char *busid) | |||
152 | err("device with the specified bus ID does not exist"); | 153 | err("device with the specified bus ID does not exist"); |
153 | return -1; | 154 | return -1; |
154 | } | 155 | } |
156 | devpath = udev_device_get_devpath(dev); | ||
155 | udev_unref(udev); | 157 | udev_unref(udev); |
156 | 158 | ||
159 | /* If the device is already attached to vhci_hcd - bail out */ | ||
160 | if (strstr(devpath, USBIP_VHCI_DRV_NAME)) { | ||
161 | err("bind loop detected: device: %s is attached to %s\n", | ||
162 | devpath, USBIP_VHCI_DRV_NAME); | ||
163 | return -1; | ||
164 | } | ||
165 | |||
157 | rc = unbind_other(busid); | 166 | rc = unbind_other(busid); |
158 | if (rc == UNBIND_ST_FAILED) { | 167 | if (rc == UNBIND_ST_FAILED) { |
159 | err("could not unbind driver from device on busid %s", busid); | 168 | err("could not unbind driver from device on busid %s", busid); |