Skip to content

Commit

Permalink
ceph: fix use-after-free for fsc->mdsc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Xiubo Li authored and Ilya Dryomov committed Aug 3, 2020
1 parent 8e298de commit a7caa88
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -4453,7 +4453,6 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
goto err_mdsc;
}

fsc->mdsc = mdsc;
init_completion(&mdsc->safe_umount_waiters);
init_waitqueue_head(&mdsc->session_close_wq);
INIT_LIST_HEAD(&mdsc->waiting_for_map);
Expand Down Expand Up @@ -4508,6 +4507,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)

strscpy(mdsc->nodename, utsname()->nodename,
sizeof(mdsc->nodename));

fsc->mdsc = mdsc;
return 0;

err_mdsmap:
Expand Down

0 comments on commit a7caa88

Please sign in to comment.