aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2022-09-18 11:51:03 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2022-09-24 16:41:26 +0000
commit701b73858e3afa15d8ca2ea4aa480173ccc5960e (patch)
treeaa2843c88f5ef50b8b8e99c6ed163c82bd6d63e7
parent70385088cafaab3365c5243f22b8fc9c712c1fde (diff)
downloadsrc-701b73858e3afa15d8ca2ea4aa480173ccc5960e.tar.gz
src-701b73858e3afa15d8ca2ea4aa480173ccc5960e.zip
msdosfs: disallow truncation to set file size past RLIMIT_FSIZE
PR: 164793 Reviewed by: asomers, jah, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36625
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 8573db682698..24d63bd343a9 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -456,6 +456,9 @@ msdosfs_setattr(struct vop_setattr_args *ap)
*/
break;
}
+ error = vn_rlimit_trunc(vap->va_size, td);
+ if (error != 0)
+ return (error);
error = detrunc(dep, vap->va_size, 0, cred);
if (error)
return error;