Received: by 10.223.176.5 with SMTP id f5csp1056388wra; Fri, 2 Feb 2018 10:24:44 -0800 (PST) X-Google-Smtp-Source: AH8x2246Z6ocSNqQ/6pxRWRhCSjScmWIu4gs1fPc/W3VJYk85RGP1trRgSoezHv6WjI0txkAhEZz X-Received: by 10.99.54.76 with SMTP id d73mr480746pga.202.1517595883925; Fri, 02 Feb 2018 10:24:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517595883; cv=none; d=google.com; s=arc-20160816; b=IVm8PhIZn7qmmh06FmRrF02lz/xXVEKF9FIFEFbFwCoDvoVoTZf7lmCVeGqowYC4CP 6iCKm7MYY7mxAXv3t8t7fGif1OjZJlYTbSH1C8yUbWaJ3rjlWlJO6H1YOiSEVfgxG3dK Ztrk/KggTxrR+fqDBVXJyUUf82ibaI5zYULdV1gnmJ4AI+yzs2gl3HToq83S6u/XkmTO 7cXT+aJxtrX1tNKz0ESS7b6mGrhUehrCDYpXRXoSTA/xHo0lxvt1LXjhmCTNefF0l7hL imQ6oGDBCV46RGTU1nKose5MUu1lCjEvOB+D5mqECAT8BtqUIUdA1YUzw7znp2Fr2/5Q GZbw== 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=OnPlwiJKYgUtlPFUbh2KYIh0NmJYdfQv0AH4qa4nQsE=; b=RMmhPWJ+yak96e/1yoL7TIg6VgfGAmVdH3REUlqkF2n38ZCfBbVLFb6f4QgWffxD3j LAadOBkwBwrA7IkV8BkJeHtGw+uEso4ejPT2M3kaejGbx+XMYX0Z6KdLH3JRa+R6H3rD zoZdvlU7+ob0HRU3uHbXVfdGwNog1pjTaLLsUwDpmKkWMgOi57+8HiKZTGAbteeOj5GW bUKbFEKVj4/CqY8yGaiyk1sWMpcgYAOD8GXWRXuRRlzppIr5EsAWWfzUanQuvPXtBwXr YRt1wRObBdBqhi4L5u/qKeTgxOwPqjD+WATYVlPHlX3TwEtKOMmbzzUuz2s4y+VNOC6o JMIg== 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 3-v6si2246164plu.181.2018.02.02.10.24.29; Fri, 02 Feb 2018 10:24:43 -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 S1754255AbeBBSXe (ORCPT + 99 others); Fri, 2 Feb 2018 13:23:34 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35426 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752411AbeBBRC1 (ORCPT ); Fri, 2 Feb 2018 12:02:27 -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 955EBE5E; Fri, 2 Feb 2018 17:02:26 +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.4 61/67] usbip: list: dont list devices attached to vhci_hcd Date: Fri, 2 Feb 2018 17:58:30 +0100 Message-Id: <20180202140821.982443896@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140815.091718203@linuxfoundation.org> References: <20180202140815.091718203@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.4-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");