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>] [day] [month] [year] [list]
Message-Id: <20230831093144.7520-1-dingxiang@cmss.chinamobile.com>
Date:   Thu, 31 Aug 2023 17:31:44 +0800
From:   Ding Xiang <dingxiang@...s.chinamobile.com>
To:     akpm@...ux-foundation.org, shuah@...nel.org
Cc:     linux-mm@...ck.org, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] selftests/mm: gup_longterm: fix a resource leak

The opened file should be closed in run_with_tmpfile(),
otherwise resource leak will occur

Signed-off-by: Ding Xiang <dingxiang@...s.chinamobile.com>
---
 tools/testing/selftests/mm/gup_longterm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/gup_longterm.c b/tools/testing/selftests/mm/gup_longterm.c
index d33d3e68ffab..ad168d35b23b 100644
--- a/tools/testing/selftests/mm/gup_longterm.c
+++ b/tools/testing/selftests/mm/gup_longterm.c
@@ -265,10 +265,11 @@ static void run_with_tmpfile(test_fn fn, const char *desc)
 	fd = fileno(file);
 	if (fd < 0) {
 		ksft_test_result_fail("fileno() failed\n");
-		return;
+		goto close;
 	}
 
 	fn(fd, pagesize);
+close:
 	fclose(file);
 }
 
-- 
2.38.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ