zfs/cmd
Richard Yao 9368b3877c Fix TOCTOU race in zpool_do_labelclear()
Coverity reported a TOCTOU race in `zpool_do_labelclear()`. This is not
believed to be a real security issue, but fixing it reduces the number
of syscalls we do and will prevent other static analyzers from
complaining about this.

The code is expected to be equivalent. However, under rare
circumstances, such as ELOOP, ENAMETOOLONG, ENOMEM, ENOTDIR and
EOVERFLOW, we will display the error message that we currently display
for the `open()` syscall rather than the one that we currently display
for the `stat()` syscall. This is considered to be an improvement.

Reported-by: Coverity (CID-1524188)
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14575
2023-03-08 13:50:51 -08:00
..
raidz_test Fix multiplication converted to larger type 2022-10-28 09:30:37 -07:00
zdb More adaptive ARC eviction 2023-03-08 11:17:23 -08:00
zed Configure zed's diagnosis engine with vdev properties 2023-01-23 13:14:25 -08:00
zfs Improve error message of zfs redact 2023-02-21 17:30:05 -08:00
zinject Fix unsafe string operations 2022-09-27 16:47:24 -07:00
zpool Fix TOCTOU race in zpool_do_labelclear() 2023-03-08 13:50:51 -08:00
zpool_influxdb Fix unchecked return values 2022-09-29 09:02:57 -07:00
zstream Reject streams that set ->drr_payloadlen to unreasonably large values 2023-01-23 13:16:22 -08:00
Makefile.am Add zilstat script to report zil kstats in a user friendly manner 2022-09-02 13:24:07 -07:00
arc_summary More adaptive ARC eviction 2023-03-08 11:17:23 -08:00
arcstat.in Update arc_summary and arcstat outputs 2023-01-05 09:29:13 -08:00
dbufstat.in Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
fsck.zfs.in cmd: move single-file binaries up, extract udev programs to udev/ 2022-05-10 10:20:34 -07:00
mount_zfs.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_ids_to_path.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zgenhostid.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zhack.c Cleanup: zhack should not declare function prototypes in main() 2022-12-08 13:51:24 -08:00
zilstat.in Add zilstat script to report zil kstats in a user friendly manner 2022-09-02 13:24:07 -07:00
ztest.c Fix memory leak in ztest 2023-03-06 15:30:29 -08:00
zvol_wait zvol_wait logic may terminate prematurely 2022-10-11 12:12:04 -07:00