Skip to content

Commit f831c6c

Browse files
lxbszgregkh
authored andcommitted
ceph: fix use-after-free for fsc->mdsc
[ Upstream commit a7caa88 ] If the ceph_mdsc_init() fails, it will free the mdsc already. Reported-by: syzbot+b57f46d8d6ea51960b8c@syzkaller.appspotmail.com Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 96de3db commit f831c6c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/ceph/mds_client.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3682,7 +3682,6 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
36823682
return -ENOMEM;
36833683
}
36843684

3685-
fsc->mdsc = mdsc;
36863685
init_completion(&mdsc->safe_umount_waiters);
36873686
init_waitqueue_head(&mdsc->session_close_wq);
36883687
INIT_LIST_HEAD(&mdsc->waiting_for_map);
@@ -3723,6 +3722,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
37233722

37243723
strscpy(mdsc->nodename, utsname()->nodename,
37253724
sizeof(mdsc->nodename));
3725+
3726+
fsc->mdsc = mdsc;
37263727
return 0;
37273728
}
37283729

0 commit comments

Comments
 (0)