From: Andrea Cervesato <andrea.cervesato@suse.de>
To: Linux Test Project <ltp@lists.linux.it>
Subject: [LTP] [PATCH 2/3] lib: Close directory fd on ENOSPC in tst_fill_fs
Date: Fri, 17 Jul 2026 14:33:19 +0200 [thread overview]
Message-ID: <20260717-fix_core_library-v1-2-c575fcbb2cb3@suse.com> (raw)
In-Reply-To: <20260717-fix_core_library-v1-0-c575fcbb2cb3@suse.com>
From: Andrea Cervesato <andrea.cervesato@suse.com>
The directory descriptor opened at the top of the function was leaked
when openat() failed with ENOSPC and the function returned early. Close
it before returning.
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
lib/tst_fill_fs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/tst_fill_fs.c b/lib/tst_fill_fs.c
index c62d48e289965d59ef6c877870c6047bbecb33da..b1e48fdeea6ab00848aab482fd3899fc6f6ce23c 100644
--- a/lib/tst_fill_fs.c
+++ b/lib/tst_fill_fs.c
@@ -91,6 +91,7 @@ static void fill_flat_vec(const char *path, int verbose)
if (fd == -1) {
if (errno == ENOSPC) {
tst_res(TINFO | TERRNO, "openat()");
+ SAFE_CLOSE(dir);
return;
}
tst_brk(TBROK | TERRNO, "openat(%d, %d, 0600) failed for path %s",
--
2.51.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-07-17 12:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 12:33 [LTP] [PATCH 0/3] Fix bugs in LTP core library Andrea Cervesato
2026-07-17 12:33 ` [LTP] [PATCH 1/3] lib: Avoid loop_info.lo_name buffer overflow Andrea Cervesato
2026-07-17 13:33 ` [LTP] " linuxtestproject.agent
2026-07-17 12:33 ` Andrea Cervesato [this message]
2026-07-17 12:33 ` [LTP] [PATCH 3/3] lib: Fix wrong field in tst_iovec_alloc Andrea Cervesato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260717-fix_core_library-v1-2-c575fcbb2cb3@suse.com \
--to=andrea.cervesato@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.