Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce76fd30 authored by Mark Fasheh's avatar Mark Fasheh
Browse files

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: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent 7c08d70c
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -1028,6 +1028,11 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
	}
	}


	if (size_change && attr->ia_size != i_size_read(inode)) {
	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)
		if (i_size_read(inode) > attr->ia_size)
			status = ocfs2_truncate_file(inode, bh, attr->ia_size);
			status = ocfs2_truncate_file(inode, bh, attr->ia_size);
		else
		else