Received: by 10.223.176.5 with SMTP id f5csp1047896wra; Fri, 2 Feb 2018 10:15:30 -0800 (PST) X-Google-Smtp-Source: AH8x224YJVMvAaf3Fk0OUy4D9KKZ7nUTJXBv/tz8ksepLgAbGHK1Y5zNaOqwhedhLqBHks/AANI4 X-Received: by 10.101.74.71 with SMTP id a7mr32549505pgu.32.1517595330836; Fri, 02 Feb 2018 10:15:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517595330; cv=none; d=google.com; s=arc-20160816; b=xMt/0kYIJSu9sIpcUMeSzT7WG7rCQ8Sd+3xfr1ezWNlFJgb+Dphhu/LGlNUZQWDvgV vRcFM8wYXQ6p2+Fgsm5TMdgd8m/jxhCJnoMp+vdeNjGOMYf2p//tHtlQcqoZfH2s1mq0 h6ZBAbEK87G53vjMVG6xuEVTmFLpMEixDWs/98Q4m5LYqYfcImb9oWJheqiJisHUQL5h R/v1521fx7EhEf9aeWHWOO63tL1X5aYe3UhnuoWJETyb95y+V6oKULIKfrafdCez2Hts k2XBGBj4k7uNCNLJvjW4zae4uelNP26XsVhJmFA1g3z+vWZF95Uwg9EVDpkCAT+TJjTC 7zug== 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=SF6WPRhc/FVuPrGFV/PcE/xF/Xpw+ehAg+7NtbIMS8M=; b=zMoid+sjsWgdKxX9q4DMzZwip2HivuJxO7Hlc5PeFvU19pzQYZ3XvvLWWEaVWcFWzi lEetbhL6zYr+/xJ7988gawibTke2OvkSByRmiD0bUgDeRH8YBzCTO556QJIRE2lrATGx 748i8kdlSGdRG4A6hXLN4ivbSmyM6ZPQ7Zp1P06bS5ITG3H32SqAtM9JZhTd0YZCLZaz ZzRfvygmKk676DFFAOQVDbaTGdpB3g53GPa3JAI/S0ch1fysXIy9lXvaQMVzVsbsio2P pElUnpwOQkIVQ+fy7dKc/n0Utjj9eq78YZHdxBygS8uMgWk4c4+3H+ZzOsPSLc1SzBU6 YFRg== 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 f4-v6si2221579plb.482.2018.02.02.10.15.15; Fri, 02 Feb 2018 10:15:30 -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 S1754135AbeBBSOW (ORCPT + 99 others); Fri, 2 Feb 2018 13:14:22 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36754 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752779AbeBBRGY (ORCPT ); Fri, 2 Feb 2018 12:06:24 -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 F28D7E3B; Fri, 2 Feb 2018 17:06:22 +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.9 79/86] usbip: list: dont list devices attached to vhci_hcd Date: Fri, 2 Feb 2018 17:58:39 +0100 Message-Id: <20180202140829.942628549@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140822.679101338@linuxfoundation.org> References: <20180202140822.679101338@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.9-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");