linux/tools/testing/selftests/filesystems/statmount
Malaya Kumar Rout 8c8fe5c77b
selftests/statmount: Fix file descriptor leak in setup_namespace
In setup_namespace(), f_mountinfo is opened with fopen() at line 115
but is never closed. Multiple ksft_exit_fail_msg() calls exit the
program without closing this file descriptor, and the cleanup_namespace()
function registered with atexit() also doesn't close it.

Add fclose(f_mountinfo) in cleanup_namespace() to ensure the file
descriptor is properly closed on both normal and error exit paths,
since cleanup_namespace() is already registered as an atexit handler.

Signed-off-by: Malaya Kumar Rout <malayarout91@gmail.com>
Link: https://patch.msgid.link/20260704120437.99851-1-malayarout91@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-07-31 10:09:06 +02:00
..
.gitignore selftests/filesystems: Add missing gitignore file 2025-01-14 17:06:31 -07:00
listmount_test.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
Makefile selftests/filesystems: create get_unique_mnt_id() helper 2025-05-12 11:40:12 +02:00
statmount_test_ns.c selftests/statmount: remove duplicate wait_for_pid() 2026-04-14 09:30:31 +02:00
statmount_test.c selftests/statmount: Fix file descriptor leak in setup_namespace 2026-07-31 10:09:06 +02:00
statmount.h selftests/statmount: add statmount_alloc() helper 2026-03-12 13:33:54 +01:00