mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
ceph: fix use-after-free on symlink traversal
[ Upstream commit daf5cc27ee ]
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
cbce4a687c
commit
9b0d0e776d
@@ -520,6 +520,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);
|
||||
}
|
||||
|
||||
@@ -551,7 +552,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);
|
||||
|
||||
Reference in New Issue
Block a user