git: 064d5d4dee05 - stable/13 - tmpfs: disallow truncation to set file size past RLIMIT_FSIZE
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 08 Oct 2022 00:39:09 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=064d5d4dee053f70ff82f9a1f98ed42e38f36b47
commit 064d5d4dee053f70ff82f9a1f98ed42e38f36b47
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-09-18 13:28:11 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-10-08 00:29:35 +0000
tmpfs: disallow truncation to set file size past RLIMIT_FSIZE
PR: 164793
(cherry picked from commit b5b16659c5aceb9caa0a9b76c7746e1d12a505ce)
---
sys/fs/tmpfs/tmpfs_subr.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 6c8d9bd9a0ff..f60dc81c648c 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -2045,6 +2045,10 @@ tmpfs_chsize(struct vnode *vp, u_quad_t size, struct ucred *cred,
if (node->tn_flags & (IMMUTABLE | APPEND))
return (EPERM);
+ error = vn_rlimit_trunc(size, td);
+ if (error != 0)
+ return (error);
+
error = tmpfs_truncate(vp, size);
/*
* tmpfs_truncate will raise the NOTE_EXTEND and NOTE_ATTRIB kevents