lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230413024125.3082418-1-zenghao@kylinos.cn>
Date:   Thu, 13 Apr 2023 10:41:25 +0800
From:   Hao Zeng <zenghao@...inos.cn>
To:     linux-perf-users@...r.kernel.org
Cc:     peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
        mark.rutland@....com, alexander.shishkin@...ux.intel.com,
        jolsa@...nel.org, namhyung@...nel.org, irogers@...gle.com,
        adrian.hunter@...el.com, james.clark@....com,
        suzuki.poulose@....com, ravi.bangoria@....com, seanjc@...gle.com,
        linux-kernel@...r.kernel.org, Hao Zeng <zenghao@...inos.cn>
Subject: [PATCH] perf pmu: Fix resource leaks in pmu_cpumask()

The perf_pmu__open_file() and perf_cpu_map__read()
are called to process the file,but the file is not closed,
which may cause a file handle leak.

Signed-off-by: Hao Zeng <zenghao@...inos.cn>
---
 tools/perf/util/pmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index c256b29defad..3b4d2f531d83 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -583,6 +583,7 @@ static struct perf_cpu_map *pmu_cpumask(const char *name)
 		if (!file)
 			continue;
 		cpus = perf_cpu_map__read(file);
+		fclose(file);
 		if (cpus)
 			return cpus;
 	}
-- 
2.37.2


No virus found
		Checked by Hillstone Network AntiVirus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ