From 8728d5f04d924285af16d918e8b6b79f648b5276 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Fri, 20 Jul 2007 12:02:14 -0700 Subject: 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 --- fs/ocfs2/file.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index fb74a03..fb72cd5 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -993,6 +993,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 -- 1.5.3.4