Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Oct 2022 00:39:06 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 3936744da50c - stable/13 - UFS: disallow truncation to set file size past RLIMIT_FSIZE
Message-ID:  <202210080039.2980d6nJ034305@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=3936744da50c0f10466780305208f61542131898

commit 3936744da50c0f10466780305208f61542131898
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-09-18 11:49:57 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-10-08 00:29:35 +0000

    UFS: disallow truncation to set file size past RLIMIT_FSIZE
    
    PR:     164793
    
    (cherry picked from commit 70385088cafaab3365c5243f22b8fc9c712c1fde)
---
 sys/ufs/ufs/ufs_vnops.c | 3 +++
 1 file changed, 3 insertions(+)

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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202210080039.2980d6nJ034305>