Received: by 10.223.176.5 with SMTP id f5csp996104wra; Fri, 2 Feb 2018 09:26:00 -0800 (PST) X-Google-Smtp-Source: AH8x226a/n9CjzDArI1qwG0EC4hlhi/eDnkryMR3W53xEpHQGdXQi0vBc/dhJtmOMy+P021Y8Z6a X-Received: by 10.101.97.165 with SMTP id i5mr20882599pgv.55.1517592360169; Fri, 02 Feb 2018 09:26:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517592360; cv=none; d=google.com; s=arc-20160816; b=EsVelKR+dEo7mBcA4qmXWFI9SJ7CNEkBGB4KulqRItgboTeVBKT2Bkqu6hUPW3lvU0 pQWeOO6eDrPN4dMlzVUzuF/NK0Zm8wwxIwKC1a34cn3N3tc4SBEvBER699IdZzKchnhD 0RDCujqomJMFogTAPIjAfwT+QT9BsPuP8uWFyjde1XhhpjkA6LYH9YsgSoKcxC5yvSMe 0q8jxWtygrdQLUmjG9YPq7DczHhltSR3gJIHC2TyyBcnhM3E+hUYieuVIck9IAlJEi77 a+3dtYBMQoJrrIK+w7LapfFca7/b8ghPjApD5f4v8XmPRT0IIOPP+9XSeWaZ58A2TD6q AuAA== 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=GT8eCIALRKGr6d3MmI+PQIKTKbdrtv7pfd8HM/oTMB0=; b=yy8AMdViR7MMrb2s96kCgdDjgnHSdCj3lZ9L9SdZrI6amnLL2qNe5CduaRsP8eYGsm 6ZtVi22isKlzEW8Z5MiuO3i4k+owurpcIDfMdhtIAOpC3Cxe18L7hJn56PF0JkP523+v riOxvbLXAwl3CZ8TW20WLBjRJxAtfAyuUI2LVflIRgm8gw3Dvhxki2vO+gVGly9mhN6F iMW/nehsPNyp6Bz696CT1BbuVTvkydui6Gb8l1d2Chpa1YA4HqF/+7IsyZF6n3huBpAm m3fGoxEk7TeALuCdw5Mq3s0enzGhZcMJybKBzlpELWe9QneJ/03krMicC46uu63JkQi9 Qa8A== 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 f30-v6si45646plj.658.2018.02.02.09.25.45; Fri, 02 Feb 2018 09:26: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 S1754099AbeBBRYn (ORCPT + 99 others); Fri, 2 Feb 2018 12:24:43 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40536 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753648AbeBBROg (ORCPT ); Fri, 2 Feb 2018 12:14:36 -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 5D3D6AD8; Fri, 2 Feb 2018 17:14:35 +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.14 139/156] usbip: list: dont list devices attached to vhci_hcd Date: Fri, 2 Feb 2018 17:58:40 +0100 Message-Id: <20180202140846.663815139@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@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.14-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");