aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2007-07-20 12:02:14 -0700
committerMark Fasheh <mark.fasheh@oracle.com>2007-08-09 17:25:38 -0700
commitce76fd30ce98cdaeb38dca0dfbb3fa6d2801c5ce (patch)
treeb204814a30df3e5ef5f21032ee8fb3639249b99a /fs/ocfs2
parentocfs2: Fix some casting errors related to file writes (diff)
downloadlinux-dev-ce76fd30ce98cdaeb38dca0dfbb3fa6d2801c5ce.tar.xz
linux-dev-ce76fd30ce98cdaeb38dca0dfbb3fa6d2801c5ce.zip
ocfs2: check ia_size limits in setattr
We have to manually check the requested truncate size as the check in vmtruncate() comes too late for Ocfs2. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index b1ae4c754157..4ffa715be09c 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1028,6 +1028,11 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
}
if (size_change && attr->ia_size != i_size_read(inode)) {
+ if (attr->ia_size > sb->s_maxbytes) {
+ status = -EFBIG;
+ goto bail_unlock;
+ }
+
if (i_size_read(inode) > attr->ia_size)
status = ocfs2_truncate_file(inode, bh, attr->ia_size);
else