Received: by 10.223.176.5 with SMTP id f5csp2837389wra; Mon, 5 Feb 2018 10:41:33 -0800 (PST) X-Google-Smtp-Source: AH8x226jBjkbgcGYR4NugQllp1vh1gl3wvosPU85XQPdSCuX7MSWJKqyzCj+Ys1u9YY4aiV90spV X-Received: by 10.99.150.2 with SMTP id c2mr12701364pge.424.1517856092999; Mon, 05 Feb 2018 10:41:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517856092; cv=none; d=google.com; s=arc-20160816; b=MEm+0fL81KRbSgUujtab9MjoV67eyH8sKlneR3Q62/AvnPJVJh+SlMMYzOUltqIfkG jUzKh8bh9NgpJciDsCjRfkQVlmyW2/SYDfHd1gOUGeicH+Ogk+ci6kBlLy6GslV7uP+Q YBPohvnr7cLpXOs3aOgW4+sTqyv91qqyu6EiFI8VgwQCBJfPbc+IsMzHMSLNk4UK4zV6 cKSRtAlDusCkQWr6piBYU9B4X+Vx4ROGzkryapOOKbZRqD+Ne7Wggu9B0/TP2EYq6E2s z+3HNM1cyi1t3kpgVWkqQsj56GTMxV7UJdJHiAbj/XEK5KN6xzxBHKEp8Oe3Fr+ukZ+Y gdag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=BdSkzhPtyTfvrN+IHFbGmuPsNRZ/+g7NILK4rYmmwpI=; b=V/BPPGu0IPOUsry/H7DXec50u/OvUWn+qyAhNv+kFNxfzujm5I+H452CLMkZlA/Epq svNl4cBvhWwM24WA/tZiYdnZq1E7RfIFATO+nQKZ070au7p7chKRHHoCufH/b7kCyrTe J6pZ/fWZ6M9d1wKpHiXsWjZTD3cPdgqBnXLqI9CmHxGpYVpDKy8Rt4i0Nh+2/sbVXm/P IMpiSh5SGz1LplnolGy/aFyp2tQR4HXbOWGWugpO1O/syNcUKsWTiHqeBpL1pVxj3DJu w2Gp7z1FQE7pYhW442vRUivLT1fCyFR+G5ZVl4pSWuuY7/1w+54P6Npl+J4tK5PJwei1 yHqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5-v6si295799plt.652.2018.02.05.10.41.18; Mon, 05 Feb 2018 10:41:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753707AbeBESj2 (ORCPT + 99 others); Mon, 5 Feb 2018 13:39:28 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:54268 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753570AbeBES0m (ORCPT ); Mon, 5 Feb 2018 13:26:42 -0500 Received: from localhost (unknown [104.132.1.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 32A5CDBA; Mon, 5 Feb 2018 18:26:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan Subject: [PATCH 3.18 30/36] usbip: list: dont list devices attached to vhci_hcd Date: Mon, 5 Feb 2018 10:23:58 -0800 Message-Id: <20180205182353.011400224@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180205182351.774761393@linuxfoundation.org> References: <20180205182351.774761393@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shuah Khan commit ef824501f50846589f02173d73ce3fe6021a9d2a upstream. 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. Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- tools/usb/usbip/src/usbip_list.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- 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 = -1; + const char *devpath; /* Create libudev context. */ udev = udev_new(); @@ -202,6 +203,14 @@ static int list_devices(bool parsable) path = udev_list_entry_get_name(dev_list_entry); dev = udev_device_new_from_syspath(udev, path); + /* Ignore devices attached to vhci_hcd */ + devpath = 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 = udev_device_get_sysattr_value(dev, "idVendor"); idProduct = udev_device_get_sysattr_value(dev, "idProduct");