Received: by 10.223.176.5 with SMTP id f5csp999710wra; Fri, 2 Feb 2018 09:29:00 -0800 (PST) X-Google-Smtp-Source: AH8x227hVYYe2LWKE6uMw93wwCqa9rx0Fed1NTIvR9Kp5lTquF+HmMdOjk3XNmSNKuxiRSrWkhAy X-Received: by 2002:a17:902:c81:: with SMTP id 1-v6mr35895628plt.281.1517592540677; Fri, 02 Feb 2018 09:29:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517592540; cv=none; d=google.com; s=arc-20160816; b=dlN8/ggpI2V9KOSgb1TDJ/dxi7BJe92HDYYj9SNRRcyq2ghnRfBgHBgDiR1nhyVeWS YpzbCxlTsAR5nml+qfKiVl2b14Zhf1Tg3ZMkxo6aRxEqoUC+KQcj/jNpZekMaVLQTutv kTtjfjAVqpITy8Cp4qDBEmy424m9BiTK7e0EAEPSPeZbGq44A7acMU5e53EOGKKgI2eq YYihE7hqpAICqX5oGYqaDz9jRZzaWAVy6R475GMUe0Qbx686T/MACfzSlOt6fwPMu9Wf LhjsIdpd8u8+85bokkTGdOk76VKLCRGfTsl960ap2dnzQh4TOJADv4mOPXAM+D5lXqBQ izsA== 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=ujPptxos92tx8r3zaLwSakbRpqsDiejjooRhMkLUEbk=; b=FulasVvZ4IeEX1wSGnuQbL1c+dHyyuzzrGR92ZIkdj4exvjZ7E9Xpq/hJxN1VSXEkH uhMjj75YF/uK4ClgUI7Y0Zrod3m8mSVoeLYmDlqQoPSAtaT4auxJ7DxyRe++XgXI7dDD PONFjy0GzWUXcYPB/Lp5OrCDbxFoHLRkKqNntGycuz+b8Op0dxZlbeTvlw5nQofE4eti 5SqaC+RlGKFEsYVPA8HW8+Ne5wP6zqL1WosELU80Bz2egqMnM/vMZtnCgg4iND1Bqwz0 NtcUwnewDdAcR92QHxzlAOLfmmqDNBOB+IT1vMTw/TRHm9yFQpS4Sz8pMyKnay8UTF+W Hkyg== 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 s2si1428pgc.386.2018.02.02.09.28.46; Fri, 02 Feb 2018 09:29:00 -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 S1754079AbeBBR1j (ORCPT + 99 others); Fri, 2 Feb 2018 12:27:39 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40944 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753660AbeBBRQK (ORCPT ); Fri, 2 Feb 2018 12:16:10 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 339F0ED5; Fri, 2 Feb 2018 17:16:09 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan Subject: [PATCH 4.15 37/55] usbip: list: dont list devices attached to vhci_hcd Date: Fri, 2 Feb 2018 17:58:55 +0100 Message-Id: <20180202140829.852103899@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140826.117602411@linuxfoundation.org> References: <20180202140826.117602411@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 4.15-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 @@ -187,6 +187,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(); @@ -209,6 +210,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");