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()
Unified · Split
| @@ -2071,11 +2071,6 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 2070 unmodified lines | ||
| 2071 | 2071 | if (inode_dirty_flags) |
| 2072 | 2072 | __mark_inode_dirty(inode, inode_dirty_flags); |
| 2073 | 2073 | |
| 2074 | − if (ia_valid & ATTR_MODE) { | |
| 2075 | − err = posix_acl_chmod(inode, attr->ia_mode); | |
| 2076 | − if (err) | |
| 2077 | − goto out_put; | |
| 2078 | − } | |
| 2079 | 2074 | |
| 2080 | 2075 | if (mask) { |
| 2081 | 2076 | req->r_inode = inode; |
| @@ -2088,14 +2083,12 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 6 unmodified lines | ||
| 2088 | 2083 | dout("setattr %p result=%d (%s locally, %d remote)\n", inode, err, |
| 2089 | 2084 | ceph_cap_string(dirtied), mask); |
| 2090 | 2085 | |
| 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: | |
| 2097 | 2086 | ceph_mdsc_put_request(req); |
| 2098 | 2087 | ceph_free_cap_flush(prealloc_cf); |
| 2088 | + | |
| 2089 | + if (err >= 0 && (mask & CEPH_SETATTR_SIZE)) | |
| 2090 | + __ceph_do_pending_vmtruncate(inode); | |
| 2091 | + | |
| 2099 | 2092 | return err; |
| 2100 | 2093 | } |
| 2101 | 2094 | |
| @@ -2114,7 +2107,12 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) · 12 unmodified lines | ||
| 2114 | 2107 | if (err != 0) |
| 2115 | 2108 | return err; |
| 2116 | 2109 | |
| 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; | |
| 2118 | 2116 | } |
| 2119 | 2117 | |
| 2120 | 2118 | /* |