]> err.no Git - linux-2.6/commitdiff
ocfs2: check ia_size limits in setattr
authorMark Fasheh <mark.fasheh@oracle.com>
Fri, 20 Jul 2007 19:02:14 +0000 (12:02 -0700)
committerMark Fasheh <mark.fasheh@oracle.com>
Fri, 10 Aug 2007 00:25:38 +0000 (17:25 -0700)
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>
fs/ocfs2/file.c

index b1ae4c754157e00ee34e3c7344eafe5c04e72369..4ffa715be09cff4f8243418016c0e0a08e2da40c 100644 (file)
@@ -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