/* past end of file? */
i_size = inode->i_size; /* caller holds i_mutex */
+
+ if (i_size + len > CEPH_FILE_MAX_SIZE) {
+ /* file is too big */
+ r = -EINVAL;
+ goto fail;
+ }
+
if (page_off >= i_size ||
(pos_in_page == 0 && (pos+len) >= i_size &&
end_in_page - pos_in_page != PAGE_CACHE_SIZE)) {
if (ia_valid & ATTR_SIZE) {
dout(10, "setattr %p size %lld -> %lld\n", inode,
inode->i_size, attr->ia_size);
+ if (attr->ia_size > CEPH_FILE_MAX_SIZE) {
+ err = -EINVAL;
+ goto out;
+ }
if ((issued & CEPH_CAP_FILE_EXCL) &&
attr->ia_size > inode->i_size) {
vmtruncate(inode, attr->ia_size);
ceph_mdsc_put_request(req);
__ceph_do_pending_vmtruncate(inode);
return err;
+out:
+ spin_unlock(&inode->i_lock);
+ ceph_mdsc_put_request(req);
+ return err;
}
/*