git: 27ec1f0833a1 - stable/13 - msdosfs: disallow truncation to set file size past RLIMIT_FSIZE

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 08 Oct 2022 00:39:08 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=27ec1f0833a153c4052c74e0863c556057735b26

commit 27ec1f0833a153c4052c74e0863c556057735b26
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-09-18 11:51:03 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-10-08 00:29:35 +0000

    msdosfs: disallow truncation to set file size past RLIMIT_FSIZE
    
    PR:     164793
    
    (cherry picked from commit 701b73858e3afa15d8ca2ea4aa480173ccc5960e)
---
 sys/fs/msdosfs/msdosfs_vnops.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 86af14784f5b..b9f1b678e534 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -460,6 +460,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;