Received: by 10.213.65.68 with SMTP id h4csp2116837imn; Sun, 8 Apr 2018 20:07:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/08SYkjcbXTcSFflm6wSTZG0LBVPwe4UpHWqTjkkJVT6ZIEzv6GvdHOyEYwyfonFtL1rfU X-Received: by 2002:a17:902:7688:: with SMTP id m8-v6mr26485080pll.340.1523243268294; Sun, 08 Apr 2018 20:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243268; cv=none; d=google.com; s=arc-20160816; b=wuP0ifD5XZOJ+HzibrLFbSx7LTP1veAKGmPiRid+c+3F/Gd5k5EaxsW/YXBY26UcEc nNH0S4LkZ8fJHqGEn/Z9afrIaT4AlCmgCbJxUNGZKsqVVtkrM+pl7k1ZLgxQ/9fLAZZg pt4bLoww7iD/E9oLUH8XOjQQLFF1Y85gpERi/TWiXNrwl0uYhy7oVWivZD0Mk3TPrMo1 cu92mFzKNLjpi+I3QreKy9LkDDiQ+4DkqDGOOqjkfaoVMPmQWKuPESyIZfdqmxVdSdiF OUhZpqX9n7ZjV461pZgWLxeWzMCB2v0LXXdyfN+adIpmblDLiWAhLZit0EE5+w+eFBc7 0pig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=lkx0yvkzVsdqb0/ZWH//k/ppZVjE/XnlaWdgneGwD+Q=; b=kemWhYzAa5Lt3Jq4QS/SkmCWafnQ43TFa88FkIl5nfBSuUY0X6RKCKds+bnH3d8gmK 0S92z/MSGJVPJEbcTlaDWFnhFMdSBGlNNxDwM/QjUkDihXAai3VfW1qXFDNsy/ZMqTEm +hKKhVyGTfdIKAhfUe0L1V6lmKwblV018jfeqJovbkF8nrJ24tQMnYmitOtFSZ5j1IHh UItATOs3Ci/WcfiEjRejU/dQ0Vo+/WMuL0peisn/P2+4ocR6ZMiKbO9HIMQa6OjCr6Ug IOsyyEHwV6Ri9Y7yjN7f9GFDenWuOMtDkltaKEZWLI2ZWi4a37bS/JvM+DMr/49zT22n HoKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=JjP0Ffnk; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11-v6si14778052plr.406.2018.04.08.20.07.11; Sun, 08 Apr 2018 20:07:48 -0700 (PDT) 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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=JjP0Ffnk; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932768AbeDIBfM (ORCPT + 99 others); Sun, 8 Apr 2018 21:35:12 -0400 Received: from mail-sn1nam02on0098.outbound.protection.outlook.com ([104.47.36.98]:45151 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755987AbeDIAfJ (ORCPT ); Sun, 8 Apr 2018 20:35:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=lkx0yvkzVsdqb0/ZWH//k/ppZVjE/XnlaWdgneGwD+Q=; b=JjP0Ffnk/uez7Eo9rT2VUBnowsEq0RG/SPVcRI8KSw1abvtbJZLZE1/LN4gPdHT/s1gh/vprtKNwQ5HpmwjUkxtGF3mfPtwOOWz8sP0SJJ5e+1Qr7SawYhf46tlUpj/LgnK2YiacN+T1Hg3wy8zaeMJl01iH9RFgV879euhBcdE= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0725.namprd21.prod.outlook.com (10.167.107.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:35:07 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:35:07 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Yuyang Du , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 027/162] usb: usbip tool: Fix refresh_imported_device_list() Thread-Topic: [PATCH AUTOSEL for 4.4 027/162] usb: usbip tool: Fix refresh_imported_device_list() Thread-Index: AQHTz5meYTJf1EYjlkGIMLIHgMQ23w== Date: Mon, 9 Apr 2018 00:28:02 +0000 Message-ID: <20180409002738.163941-27-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0725;7:LlGgs//XmAOJPGi7U7SYMSVExjyuY1OIJQjgCOv8DIwU5jrx5r5k7qtgPXTmd439l4z4KLHh+6cOhkcnMo6oXCBN5BpPvxHQEi8/YMyeFxj/MDY1eLwPr9KjkLVckF8kfnXN5S/jB63TbLoT+4S6Ox3dQxHxLR1mQuatz95Zj8CvTdJrsCF09HdGhXqKGQOAaKcraEfhwi+yn99J94ELJ4uVTsD6ev0DinSjpAoFnzFz9xT5K8TYS3kqZD4GK70d;20:7cCFvZZT0Lsl4BDXhPSG909u2+APoyoPo8HrouM0RzqsRRctJRMmug69h7JzlrELclA/l4coLaFvgQ4TcBMQm/d0gJ79GmS9EFgwfm4EvImk+h7/55laGfbU7LbEvDJ88Ufan4SslRD/d+WEvWAw//leDC3CQalBYIP0tbg+JSk= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 4a871b09-1ff1-4e8b-680c-08d59db1be9c x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0725; x-ms-traffictypediagnostic: DM5PR2101MB0725: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(7411616537696)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231221)(944501327)(52105095)(93006095)(93001095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0725;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0725; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(396003)(376002)(39380400002)(346002)(366004)(189003)(199004)(86612001)(102836004)(5660300001)(14454004)(476003)(68736007)(11346002)(66066001)(446003)(99286004)(76176011)(486006)(10090500001)(3660700001)(110136005)(305945005)(106356001)(316002)(105586002)(3280700002)(3846002)(10290500003)(6116002)(22452003)(6506007)(2616005)(1076002)(7736002)(54906003)(478600001)(2900100001)(2501003)(5250100002)(8936002)(25786009)(81156014)(8676002)(6666003)(6436002)(4326008)(26005)(6512007)(6486002)(81166006)(107886003)(53936002)(2906002)(86362001)(186003)(97736004)(36756003)(72206003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0725;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: tLZ5Qvvthud5JGaKI6OS0xB9Olyb2kC66k5f5Z3QYmapREXu1tnw9x5hlQpfxCSot2QoKkW1+f91APDwI9pt9CHrahHr4IdqZGBSq+Z0/55+m0bF4s3y7MqsuOdlWA+7trkMtUUKubVkBhsK5kQft/Cm1m77MguPRt/XJR9Sm9HosKO6BCCxG7fJB+1k5l7mU3J3nHWO8MnxG/WukRrTgpRYlK/pcYvJtDSg5rsEa9MQBE1iPymm2IWaSacBPSv/9Y7Di3Mk0gPXqx+ayHij0O9H3nPQ/BiT0RhToIHLvX+fLtSHitlN8qGHXxIcsAqQnT1U635kIeM1KfCl87jqILxjLUE1PEAVjBBhiyBLzYEzj3abSGu8FpglgcheUOBXA265aZuzEVCMZVfEcj6vqzuNnH+yC4XFeE2z6ic8DJE= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a871b09-1ff1-4e8b-680c-08d59db1be9c X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:28:02.4111 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0725 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yuyang Du [ Upstream commit fd92b7deb98a4edd31ffcc2d64cee36103805ff5 ] The commit 0775a9cbc694e8c7 ("usbip: vhci extension: modifications to vhci driver") introduced multiple controllers, but the status of the ports are only extracted from the first status file, fix it. Reviewed-by: Krzysztof Opasiak Signed-off-by: Yuyang Du Acked-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- tools/usb/usbip/libsrc/vhci_driver.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/= vhci_driver.c index c589cfbd1cfe..1305a36f95d8 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.c +++ b/tools/usb/usbip/libsrc/vhci_driver.c @@ -107,18 +107,33 @@ static int parse_status(const char *value) return 0; } =20 +#define MAX_STATUS_NAME 16 + static int refresh_imported_device_list(void) { const char *attr_status; + char status[MAX_STATUS_NAME+1] =3D "status"; + int i, ret; =20 - attr_status =3D udev_device_get_sysattr_value(vhci_driver->hc_device, - "status"); - if (!attr_status) { - err("udev_device_get_sysattr_value failed"); - return -1; + for (i =3D 0; i < vhci_driver->ncontrollers; i++) { + if (i > 0) + snprintf(status, sizeof(status), "status.%d", i); + + attr_status =3D udev_device_get_sysattr_value(vhci_driver->hc_device, + status); + if (!attr_status) { + err("udev_device_get_sysattr_value failed"); + return -1; + } + + dbg("controller %d", i); + + ret =3D parse_status(attr_status); + if (ret !=3D 0) + return ret; } =20 - return parse_status(attr_status); + return 0; } =20 static int get_nports(void) --=20 2.15.1