diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-03-26 01:38:58 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-04 09:20:21 +0200 |
commit | 97c4f3a8853c50968a40e183dabd2ec27feba191 (patch) | |
tree | 9842bfda35bb2fd2bc86d191591a8dd309326f5a /fs/ceph/inode.c | |
parent | 90ce58d457c252d629f79a0f473e3cfb3291616e (diff) | |
download | linux-stable-97c4f3a8853c50968a40e183dabd2ec27feba191.tar.gz linux-stable-97c4f3a8853c50968a40e183dabd2ec27feba191.tar.bz2 linux-stable-97c4f3a8853c50968a40e183dabd2ec27feba191.zip |
ceph: fix use-after-free on symlink traversal
[ Upstream commit daf5cc27eed99afdea8d96e71b89ba41f5406ef6 ]
free the symlink body after the same RCU delay we have for freeing the
struct inode itself, so that traversal during RCU pathwalk wouldn't step
into freed memory.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r-- | fs/ceph/inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 4055ab4d5c52..3e518c2ae2bf 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -524,6 +524,7 @@ static void ceph_i_callback(struct rcu_head *head) struct inode *inode = container_of(head, struct inode, i_rcu); struct ceph_inode_info *ci = ceph_inode(inode); + kfree(ci->i_symlink); kmem_cache_free(ceph_inode_cachep, ci); } @@ -561,7 +562,6 @@ void ceph_destroy_inode(struct inode *inode) ceph_put_snap_realm(mdsc, realm); } - kfree(ci->i_symlink); while ((n = rb_first(&ci->i_fragtree)) != NULL) { frag = rb_entry(n, struct ceph_inode_frag, node); rb_erase(n, &ci->i_fragtree); |