Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4036166ybg; Fri, 25 Oct 2019 12:23:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqw48jH3vj79hosX64ykjBDQ7GBM7MXwbo6uhDyJGgei+zHP0O0pY+YWX9guOJSiGu66eJoG X-Received: by 2002:aa7:c543:: with SMTP id s3mr5774162edr.272.1572031435128; Fri, 25 Oct 2019 12:23:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572031435; cv=none; d=google.com; s=arc-20160816; b=CrlqhSOeb3hGub9tejaDqY14N9S9D1GnvHl8zKxK5jssEvfuZzvPx7StWujOZ91pZs dPYJawTMFpFdDn/kSL1Cta1di45i8CoxXr208eSpM8VGBpDsQagXzErTwVZrhNRaMdQL i0++NdzbfC3VzfpKOW3mKSvVT4D2bLMsrKVQF2eAn/dqlJNiKrPCdUt9sy0YSeEyVtJ0 Ih2NcyEwDCdO3b+B0D1HQyxdaOHCvvcC6CE3DrL17vqRkYIl7uLSBEJUFD+/TZ/hL1+C vsCHV3aKPtc+01qV+iDzhUC0Zd6MP9ctxAQbVGC9dyMQHnC8lTgAiRR6Xrz9IZcFz9/d 0uYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=iTWkkAeDthQVayQqjmZx7rDKqLWiAPHO9zvWjGubHJQ=; b=fdO2X7fQP2qROi0gHoNE64t2J07dTZyI40t5V9s929swUtbedMsi6K4tu4cbCT0uls kBWAyQ2PD4KUR1Q5j5yv+5d1DF4/NhfvhSCJzcRCGpXDJVf236HihlX4tp/o+ek8JgxN fe1JReAgZp/cAcDV3xJawY2UHBKguFDeswWIqhoHDUcP9JgUN/zs9r1Pqc4F5UKhFtBz ipsZOh83+rB/pIAYxEcBNRJWO6glimqf9QTfqUrjQyrGWqHc6qVTF0O1SKoHJQr0qJp0 C4ZmA6o2tBaAxqA+A/ggZk0Mkpjoke2bMNkPh+n3MQnym4gqZQixKvveHjg5U6TskYt4 ePLg== 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 p20si1537327eju.109.2019.10.25.12.23.31; Fri, 25 Oct 2019 12:23:55 -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; 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 S1733125AbfJYEfa (ORCPT + 99 others); Fri, 25 Oct 2019 00:35:30 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5178 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727103AbfJYEfa (ORCPT ); Fri, 25 Oct 2019 00:35:30 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 11C5A2DF14389737C171; Fri, 25 Oct 2019 12:35:26 +0800 (CST) Received: from huawei.com (10.175.104.225) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Fri, 25 Oct 2019 12:35:15 +0800 From: Hewenliang To: , , , , , , , CC: , Subject: [PATCH] usbip: tools: fix fd leakage in the function of read_attr_usbip_status Date: Fri, 25 Oct 2019 00:35:15 -0400 Message-ID: <20191025043515.20053-1-hewenliang4@huawei.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.225] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We should close the fd before the return of read_attr_usbip_status. Fixes: 3391ba0e279 ("usbip: tools: Extract generic code to be shared with vudc backend") Signed-off-by: Hewenliang --- tools/usb/usbip/libsrc/usbip_host_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/usb/usbip/libsrc/usbip_host_common.c b/tools/usb/usbip/libsrc/usbip_host_common.c index 2813aa821c82..d1d8ba2a4a40 100644 --- a/tools/usb/usbip/libsrc/usbip_host_common.c +++ b/tools/usb/usbip/libsrc/usbip_host_common.c @@ -57,7 +57,7 @@ static int32_t read_attr_usbip_status(struct usbip_usb_device *udev) } value = atoi(status); - + close(fd); return value; } -- 2.19.1