Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp159416ybg; Fri, 25 Oct 2019 18:37:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyI9SO0JrurTmXHQeDDm7Ejky0sqVoAEflXcIgoD7m1+6lWGA3JZj0vhKb+ZFZZQY+ODyVD X-Received: by 2002:aa7:c513:: with SMTP id o19mr7152939edq.75.1572053845153; Fri, 25 Oct 2019 18:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572053845; cv=none; d=google.com; s=arc-20160816; b=COCpQPz/p3D2xmTk32DMS0V5a44GqwAJuZ0Psax8T1uGgMr+fU37jYNMUS6BKwH8iD MLLGzyiUbCmAFaY0LWdzVcdVscAm6o8CCrRgTzJ8dtqQ9vc8JtF+FL0jwEVd7vmiacSh H+5V8td4zh2bPrVapNKw5f7MZgbxXvM2reeVvZwKdJkcCuApdCB/daMS8gB5DueTew7k jjnhdKvevm0xJCs6n4XQaHdQMGHF29AzGbJnWTkkicd77A2XertWZU3k7b7/hUcJgGk0 GZY0CFCfbbhVHy4zHf9IDK++L/Fz6w4g0PM2gHtk3vc908v3tgqRNdgOzRXIplNKVXC/ E12Q== 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=dSLqyq/NriWMNWHNpoI5mt2p0BMt2qk6tdug7Rg5+Ig=; b=Lhbl+PDtbYD+tmr7jaieFZvKcnmiUkQUGnXcZFtRw8yNiiAn65i3YGB/k3qb4ZHBpx +3gb6WZl9OID5bHtJ8evP48hnXfHHMuRlyoLzCcnVrG2EPOBN+dwao1IeI+nv01fi9GC vXxat3+w7KZhqnRpYhpNjLIkYOBF5G4YsPzGUTnjg7iBQ0/8WFU9fImIJySs2sovo2Gy CethGhaGu31XgXTdljjKPdsUzEDPwKEB9kgi9naCeB2S0g65iTYywVdVhYpe+6IjgifJ 2kqcAmsGhMp7ImR/jW7f94hPZ0lZGRjbCkYTdachLGPScoJNbdfCty0ZJ5xqo7/XblLG zMzg== 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 j21si2287026ejn.392.2019.10.25.18.36.59; Fri, 25 Oct 2019 18:37:25 -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 S1726198AbfJZBdc (ORCPT + 99 others); Fri, 25 Oct 2019 21:33:32 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:58682 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725899AbfJZBdc (ORCPT ); Fri, 25 Oct 2019 21:33:32 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 30EA4AA6608D48243F4E for ; Sat, 26 Oct 2019 09:33:30 +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; Sat, 26 Oct 2019 09:33:21 +0800 From: Hewenliang To: CC: Subject: [PATCH] tools: PCI: Fix fd leakage Date: Fri, 25 Oct 2019 21:33:21 -0400 Message-ID: <20191026013321.59035-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 fd before the return of run_test. Fixes: 3f2ed8134834 ("tools: PCI: Add a userspace tool to test PCI endpoint") Signed-off-by: Hewenliang --- tools/pci/pcitest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c index cb1e51fcc84e..32b7c6f9043d 100644 --- a/tools/pci/pcitest.c +++ b/tools/pci/pcitest.c @@ -129,6 +129,7 @@ static int run_test(struct pci_test *test) } fflush(stdout); + close(fd); return (ret < 0) ? ret : 1 - ret; /* return 0 if test succeeded */ } -- 2.19.1