From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: "Cyril Hrubis" <chrubis@suse.cz>, "Wei Gao" <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4] tst_tmpdir: Fix buffer overflow in tst_tmpdir.c
Date: Thu, 26 Feb 2026 10:36:40 +0100 [thread overview]
Message-ID: <DGOSIY7VL1R3.1KTK35389TOL3@suse.com> (raw)
In-Reply-To: <aaALdx9zYZDUzs2G@yuki.lan>
Hi!
On Thu Feb 26, 2026 at 9:59 AM CET, Cyril Hrubis wrote:
> Hi!
> > diff --git a/lib/tst_tmpdir.c b/lib/tst_tmpdir.c
> > index 9b024a74e..0c06a306c 100644
> > --- a/lib/tst_tmpdir.c
> > +++ b/lib/tst_tmpdir.c
> > @@ -186,8 +186,10 @@ static int purge_dirat(int dir_fd, const char *path, char **errptr)
> > continue;
> >
> > /* Recursively remove the current entry */
> > - if (rmobjat(subdir_fd, dir_ent->d_name, errptr) != 0)
> > + if (rmobjat(subdir_fd, dir_ent->d_name, errptr) != 0) {
> > + close(subdir_fd); <<<<<<<<<< first close
> > ret_val = -1;
> > + }
> > }
> >
> > closedir(dir); <<<<<<<<<<<<< second close
>
> Ah, right, we hand the fd to the fdopendir() and it's closed in the
> closedir() call. I've missed that since the closedir() is not shown in
> the diff since that part of the code wasn't modified and haven't shown
> up in the diff.
>
> The patch looks good to me then.
Feel free to ack and merge :-)
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-02-26 9:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 14:16 [LTP] [PATCH v1] tst_tmpdir: Fix buffer overflow in tst_tmpdir.c Wei Gao via ltp
2025-05-22 19:39 ` Petr Vorel
2025-05-23 6:01 ` Jan Stancek via ltp
2025-05-23 6:29 ` Petr Vorel
2025-05-23 6:29 ` Cyril Hrubis
2025-05-23 21:09 ` [LTP] [PATCH v2] " Wei Gao via ltp
2025-11-13 14:38 ` Cyril Hrubis
2025-11-14 8:58 ` Petr Vorel
2025-11-25 4:39 ` Wei Gao via ltp
2025-11-25 4:36 ` Wei Gao via ltp
2025-11-25 4:40 ` [LTP] [PATCH v3] " Wei Gao via ltp
2026-02-17 15:01 ` Andrea Cervesato via ltp
2026-02-25 1:50 ` [LTP] [PATCH v4] " Wei Gao via ltp
2026-02-25 7:38 ` Andrea Cervesato via ltp
2026-02-25 7:38 ` Andrea Cervesato via ltp
2026-02-25 10:58 ` Cyril Hrubis
2026-02-26 1:34 ` Wei Gao via ltp
2026-02-26 8:59 ` Cyril Hrubis
2026-02-26 9:36 ` Andrea Cervesato via ltp [this message]
2026-02-26 12:26 ` Cyril Hrubis
2025-09-01 15:08 ` [LTP] [PATCH v1] " Cyril Hrubis
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=DGOSIY7VL1R3.1KTK35389TOL3@suse.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=chrubis@suse.cz \
--cc=wegao@suse.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox