HomeFreeBSD

Fix oversights from 4170ae4e

Description

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

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Oct 31 2022, 5:01 PM
GitHub <noreply@github.com>Committed on Oct 31 2022, 5:01 PM
Parents
rGb37d495e04ed: Avoid null pointer dereference in dsl_fs_ss_limit_check()
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rGdcce0dc5f009: Fix oversights from 4170ae4e (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Oct 31 2022, 5:01 PM