freebsd-dev/sys/contrib
Antonio Russo e9d419a053 Set file mode during zfs_write
Apply https://github.com/openzfs/zfs/pull/11576

Direct commit from upstream openzfs. Full commit message below:

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

Obtained from:	openzfs/zfs@f8ce8aed0
MFC after:	0 days
Sponsored by:	iXsystems, Inc.
2021-02-09 12:30:06 -05:00
..
alpine-hal
ck Remove FreeBSD/armv4 specific bits from CK. 2020-04-13 23:16:32 +00:00
cloudabi
dev acpica: Import ACPICA 20210105. 2021-01-29 20:53:07 -05:00
device-tree Re-apply f81b2b9a8a to the new device-tree import 2021-01-15 20:07:13 +01:00
dpdk_rte_lpm Bring DPDK route lookups to FreeBSD. 2021-01-09 12:41:04 +00:00
edk2 Document upgrade procedure in FREEBSD-upgrade 2020-06-04 20:48:57 +00:00
ena-com Adjust ENA driver files to latest ena-com changes 2020-11-18 14:59:22 +00:00
ipfilter/netinet Simplify the FreeBSD check using __FreeBSD__ compiler macro. 2021-02-08 16:36:27 -08:00
libb2
libfdt
libnv Rename nvpair.c to bsd_nvpair.c to not conflict with openzfs' version. 2020-06-27 00:55:03 +00:00
libsodium Add chacha20poly1305 support to crypto build 2020-02-16 00:03:09 +00:00
ncsw [PowerPC] [Book-E] Remove obsolete interrupt binding workaround 2020-02-25 22:03:30 +00:00
ngatm
octeon-sdk Fix misleading indentation warning in OCTEON1 kernel 2020-03-17 11:59:45 +00:00
openzfs Set file mode during zfs_write 2021-02-09 12:30:06 -05:00
pcg-c/include pcg-c: Add 'static' to inline function definitions 2020-08-15 18:46:26 +00:00
rdma/krping Fix memory leaks in error paths in krping. 2021-01-08 12:35:55 +01:00
v4l
vchiq/interface vchiq: Rename timer func so they do not conflict with linuxkpi 2020-11-17 14:41:23 +00:00
x86emu
xz-embedded Modularize xz. 2019-02-26 19:55:03 +00:00
zlib MFV r351500: Fix CLEAR_HASH macro to be usable as a single statement. 2019-08-26 00:46:39 +00:00
zstd libprivatezstd: Restrict symbol visibility similar to upstream 2021-01-03 11:26:46 -08:00