Commit f831c6c9 authored by Xiubo Li's avatar Xiubo Li Committed by Greg Kroah-Hartman

ceph: fix use-after-free for fsc->mdsc

[ Upstream commit a7caa88f ]

If the ceph_mdsc_init() fails, it will free the mdsc already.

Reported-by: syzbot+b57f46d8d6ea51960b8c@syzkaller.appspotmail.com
Signed-off-by: default avatarXiubo Li <xiubli@redhat.com>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 96de3dbf
...@@ -3682,7 +3682,6 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) ...@@ -3682,7 +3682,6 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
return -ENOMEM; return -ENOMEM;
} }
fsc->mdsc = mdsc;
init_completion(&mdsc->safe_umount_waiters); init_completion(&mdsc->safe_umount_waiters);
init_waitqueue_head(&mdsc->session_close_wq); init_waitqueue_head(&mdsc->session_close_wq);
INIT_LIST_HEAD(&mdsc->waiting_for_map); INIT_LIST_HEAD(&mdsc->waiting_for_map);
...@@ -3723,6 +3722,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) ...@@ -3723,6 +3722,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
strscpy(mdsc->nodename, utsname()->nodename, strscpy(mdsc->nodename, utsname()->nodename,
sizeof(mdsc->nodename)); sizeof(mdsc->nodename));
fsc->mdsc = mdsc;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment