aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2022-09-18 11:49:57 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2022-10-08 00:29:35 +0000
commit3936744da50c0f10466780305208f61542131898 (patch)
tree50a51384fe1a9fcd51b30e29ab2de5605d88675e
parent9ec3a87c969da7de438ef5aa67cdc7f43d0dc894 (diff)
downloadsrc-3936744da50c0f10466780305208f61542131898.tar.gz
src-3936744da50c0f10466780305208f61542131898.zip
UFS: disallow truncation to set file size past RLIMIT_FSIZE
PR: 164793 (cherry picked from commit 70385088cafaab3365c5243f22b8fc9c712c1fde)
-rw-r--r--sys/ufs/ufs/ufs_vnops.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index c4af984745bf..71cee6ad7181 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -754,6 +754,9 @@ ufs_setattr(
*/
return (0);
}
+ error = vn_rlimit_trunc(vap->va_size, td);
+ if (error != 0)
+ return (error);
if ((error = UFS_TRUNCATE(vp, vap->va_size, IO_NORMAL |
((vap->va_vaflags & VA_SYNC) != 0 ? IO_SYNC : 0),
cred)) != 0)