From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bn3nam01on0132.outbound.protection.outlook.com ([104.47.33.132]:63564 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032349AbeCAPdA (ORCPT ); Thu, 1 Mar 2018 10:33:00 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Shuah Khan , Greg Kroah-Hartman , Sasha Levin Subject: [added to the 4.1 stable tree] usbip: list: don't list devices attached to vhci_hcd Date: Thu, 1 Mar 2018 15:25:38 +0000 Message-ID: <20180301152116.1486-287-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Shuah Khan This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit ef824501f50846589f02173d73ce3fe6021a9d2a ] 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- tools/usb/usbip/src/usbip_list.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/usb/usbip/src/usbip_list.c b/tools/usb/usbip/src/usbip_l= ist.c index d5ce34a410e7..ac6081c3db82 100644 --- a/tools/usb/usbip/src/usbip_list.c +++ b/tools/usb/usbip/src/usbip_list.c @@ -180,6 +180,7 @@ static int list_devices(bool parsable) const char *busid; char product_name[128]; int ret =3D -1; + const char *devpath; =20 /* Create libudev context. */ udev =3D udev_new(); @@ -202,6 +203,14 @@ static int list_devices(bool parsable) path =3D udev_list_entry_get_name(dev_list_entry); dev =3D udev_device_new_from_syspath(udev, path); =20 + /* Ignore devices attached to vhci_hcd */ + devpath =3D udev_device_get_devpath(dev); + if (strstr(devpath, USBIP_VHCI_DRV_NAME)) { + dbg("Skip the device %s already attached to %s\n", + devpath, USBIP_VHCI_DRV_NAME); + continue; + } + /* Get device information. */ idVendor =3D udev_device_get_sysattr_value(dev, "idVendor"); idProduct =3D udev_device_get_sysattr_value(dev, "idProduct"); --=20 2.14.1