]> git.proxmox.com Git - mirror_zfs.git/commit
Fix oversights from 4170ae4e
authorRichard Yao <richard.yao@alumni.stonybrook.edu>
Mon, 31 Oct 2022 17:01:04 +0000 (13:01 -0400)
committerGitHub <noreply@github.com>
Mon, 31 Oct 2022 17:01:04 +0000 (10:01 -0700)
commitdcce0dc5f009e8a3ec6dc48f5fc99abc4d74200f
treee2258989753a696b0d62aeebe814f1e4cdcb5d50
parentb37d495e04ed6fc0012b2eccfff80af9e8887422
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 <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14109
lib/libshare/os/linux/smb.c
tests/zfs-tests/tests/functional/tmpfile/tmpfile_stat_mode.c