aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2022-10-31 13:01:04 -0400
committerGitHub <[email protected]>2022-10-31 10:01:04 -0700
commitdcce0dc5f009e8a3ec6dc48f5fc99abc4d74200f (patch)
treee2258989753a696b0d62aeebe814f1e4cdcb5d50 /tests
parentb37d495e04ed6fc0012b2eccfff80af9e8887422 (diff)
Fix oversights from 4170ae4e
4170ae4ea600fea6ac9daa8b145960c9de3915fc was intended to tackle TOCTOU race conditions reported by CodeQL, but as an oversight, a file descriptor was not closed and some comments were not updated. Interestingly, CodeQL did not complain about the file descriptor leak, so there is room for improvement in how we configure it to try to detect this issue so that we get early warning about this. In addition, an optimization opportunity was missed by mistake in lib/libshare/os/linux/smb.c, which prevented us from truly closing the TOCTOU race. This was also caught by Coverity. Reported-by: Coverity (CID 1524424) Reported-by: Coverity (CID 1526804) Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #14109
Diffstat (limited to 'tests')
-rw-r--r--tests/zfs-tests/tests/functional/tmpfile/tmpfile_stat_mode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/zfs-tests/tests/functional/tmpfile/tmpfile_stat_mode.c b/tests/zfs-tests/tests/functional/tmpfile/tmpfile_stat_mode.c
index 1a934a8b1..8f936d36d 100644
--- a/tests/zfs-tests/tests/functional/tmpfile/tmpfile_stat_mode.c
+++ b/tests/zfs-tests/tests/functional/tmpfile/tmpfile_stat_mode.c
@@ -37,12 +37,12 @@
/*
* DESCRIPTION:
- * Verify stat(2) for O_TMPFILE file considers umask.
+ * Verify fstat(2) for O_TMPFILE file considers umask.
*
* STRATEGY:
* 1. open(2) with O_TMPFILE.
* 2. linkat(2).
- * 3. fstat(2)/stat(2) and verify .st_mode value.
+ * 3. fstat(2) and verify .st_mode value.
*/
static void
@@ -94,6 +94,7 @@ test_stat_mode(mode_t mask)
mode = fst.st_mode & 0777;
if (mode != masked)
errx(8, "fstat(2) %o != %o\n", mode, masked);
+ close(fd);
}
int