blob: a2b8aa7cbb1275dd497dde0c77c9ef8b22e82b80 [file] [log] [blame]
From 4165e3f8df7e4bd1052b376286c1b4b0275bc1f4 Mon Sep 17 00:00:00 2001
From: Hewenliang <hewenliang4@huawei.com>
Date: Fri, 25 Oct 2019 21:35:55 -0400
Subject: [PATCH] tools: PCI: Fix fd leakage
commit 3c379a59b4795d7279d38c623e74b9790345a32b upstream.
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 <hewenliang4@huawei.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c
index 49ddfa6f5a8c..dd834c06609e 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.7.4