raw/ioat: fix resource leak for directory handle

Message ID 20210506111927.787415-1-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series raw/ioat: fix resource leak for directory handle |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/github-robot success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation fail Compilation issues
ci/intel-Testing success Testing PASS

Commit Message

Bruce Richardson May 6, 2021, 11:19 a.m. UTC
  When reading the /dev directory as part of the bus scan for DSA devices,
the directory handle from opendir was not freed on function return,
leading to a resource leak.

Coverity issue: 370588
Fixes: b7aaf417f936 ("raw/ioat: add bus driver for device scanning automatically")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/raw/ioat/idxd_bus.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Thomas Monjalon May 10, 2021, 10:11 a.m. UTC | #1
06/05/2021 13:19, Bruce Richardson:
> When reading the /dev directory as part of the bus scan for DSA devices,
> the directory handle from opendir was not freed on function return,
> leading to a resource leak.
> 
> Coverity issue: 370588
> Fixes: b7aaf417f936 ("raw/ioat: add bus driver for device scanning automatically")
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks
  

Patch

diff --git a/drivers/raw/ioat/idxd_bus.c b/drivers/raw/ioat/idxd_bus.c
index 5b448d49de..5199786785 100644
--- a/drivers/raw/ioat/idxd_bus.c
+++ b/drivers/raw/ioat/idxd_bus.c
@@ -312,6 +312,7 @@  dsa_scan(void)
 		dev->device.numa_node = numa_node;
 	}
 
+	closedir(dev_dir);
 	return 0;
 }