From patchwork Fri Oct 25 04:35:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hewenliang X-Patchwork-Id: 11211279 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98D0E112C for ; Fri, 25 Oct 2019 04:36:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7A36F20867 for ; Fri, 25 Oct 2019 04:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731925AbfJYEfa (ORCPT ); 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 X-Originating-IP: [10.175.104.225] X-CFilter-Loop: Reflected Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@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; }