From: Mark Fasheh Date: Fri, 20 Jul 2007 19:02:14 +0000 (-0700) Subject: ocfs2: check ia_size limits in setattr X-Git-Tag: v2.6.23-rc3~11^2~5 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce76fd30ce98cdaeb38dca0dfbb3fa6d2801c5ce;p=linux-2.6 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 --- diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index b1ae4c7541..4ffa715be0 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