linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools: PCI: Fix fd leakage
@ 2019-10-26  1:35 Hewenliang
  2019-10-29  5:39 ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 3+ messages in thread
From: Hewenliang @ 2019-10-26  1:35 UTC (permalink / raw)
  To: kishon, lorenzo.pieralisi, linux-pci, linux-kernel, bhelgaas
  Cc: linfeilong, hewenliang4

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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools: PCI: Fix fd leakage
  2019-10-26  1:35 [PATCH] tools: PCI: Fix fd leakage Hewenliang
@ 2019-10-29  5:39 ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2019-10-29  5:39 UTC (permalink / raw)
  To: Hewenliang, lorenzo.pieralisi, linux-pci, linux-kernel, bhelgaas
  Cc: linfeilong



On 26/10/19 7:05 AM, Hewenliang wrote:
> 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>

Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  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 */
>  }
>  
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] tools: PCI: Fix fd leakage
@ 2019-10-26  1:33 Hewenliang
  0 siblings, 0 replies; 3+ messages in thread
From: Hewenliang @ 2019-10-26  1:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: hewenliang4

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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-29  5:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-26  1:35 [PATCH] tools: PCI: Fix fd leakage Hewenliang
2019-10-29  5:39 ` Kishon Vijay Abraham I
  -- strict thread matches above, loose matches on Subject: below --
2019-10-26  1:33 Hewenliang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).