History

Merge tag 'ceph-for-4.11-rc9' of git://github.com/ceph/ceph-client

Pull ceph fix from Ilya Dryomov: "A fix for a kernel stack overflow bug in ceph setattr code, marked for stable" * tag 'ceph-for-4.11-rc9' of git://github.com/ceph/ceph-client: ceph: fix recursion between ceph_set_acl() and __ceph_setattr()

Linus Torvalds committed 9 years ago

Commit 19ac4472 parents f56fc7b 8179a101 file · +10 −12Browse files

Unified · Split

fs/ceph/inode.c+10−12
@@ -2071,11 +2071,6 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 2070 unmodified lines
20712071 if (inode_dirty_flags)
20722072 __mark_inode_dirty(inode, inode_dirty_flags);
20732073
2074− if (ia_valid & ATTR_MODE) {
2075− err = posix_acl_chmod(inode, attr->ia_mode);
2076− if (err)
2077− goto out_put;
2078− }
20792074
20802075 if (mask) {
20812076 req->r_inode = inode;
@@ -2088,14 +2083,12 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 6 unmodified lines
20882083 dout("setattr %p result=%d (%s locally, %d remote)\n", inode, err,
20892084 ceph_cap_string(dirtied), mask);
20902085
2091− ceph_mdsc_put_request(req);
2092− if (mask & CEPH_SETATTR_SIZE)
2093− __ceph_do_pending_vmtruncate(inode);
2094− ceph_free_cap_flush(prealloc_cf);
2095− return err;
2096−out_put:
20972086 ceph_mdsc_put_request(req);
20982087 ceph_free_cap_flush(prealloc_cf);
2088+
2089+ if (err >= 0 && (mask & CEPH_SETATTR_SIZE))
2090+ __ceph_do_pending_vmtruncate(inode);
2091+
20992092 return err;
21002093 }
21012094
@@ -2114,7 +2107,12 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) · 12 unmodified lines
21142107 if (err != 0)
21152108 return err;
21162109
2117− return __ceph_setattr(inode, attr);
2110+ err = __ceph_setattr(inode, attr);
2111+
2112+ if (err >= 0 && (attr->ia_valid & ATTR_MODE))
2113+ err = posix_acl_chmod(inode, attr->ia_mode);
2114+
2115+ return err;
21182116 }
21192117
21202118 /*