]> git.proxmox.com Git - mirror_zfs.git/commit
Set file mode during zfs_write
authorAntonio Russo <aerusso@aerusso.net>
Mon, 8 Feb 2021 17:15:05 +0000 (10:15 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 8 Feb 2021 17:20:38 +0000 (09:20 -0800)
commit8829ba19b7fb47bef6affac8d82ed6d56dbf6d38
tree3abcd171d9e7573d77188d580ecc5792cbe1ff5b
parent642d86af0d91b2bf88d5ea34cb6888b03c39c459
Set file mode during zfs_write

3d40b65 refactored zfs_vnops.c, which shared much code verbatim between
Linux and BSD.  After a successful write, the suid/sgid bits are reset,
and the mode to be written is stored in newmode.  On Linux, this was
propagated to both the in-memory inode and znode, which is then updated
with sa_update.

3d40b65 accidentally removed the initialization of newmode, which
happened to occur on the same line as the inode update (which has been
moved out of the function).

The uninitialized newmode can be saved to disk, leading to a crash on
stat() of that file, in addition to a merely incorrect file mode.

Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Antonio Russo <aerusso@aerusso.net>
Closes #11474
Closes #11576
module/zfs/zfs_vnops.c