diff options
author | Xiubo Li <xiubli@redhat.com> | 2020-07-23 10:32:25 +0300 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2020-08-03 12:05:27 +0300 |
commit | a7caa88f8b72c136f9a401f498471b8a8e35370d (patch) | |
tree | 08efb231b4755dcc01756adf5e8f2817d6ec1e08 /fs/ceph | |
parent | 8e298deb8d8c449d87acceab8c8bfef71b67b08d (diff) | |
download | linux-a7caa88f8b72c136f9a401f498471b8a8e35370d.tar.xz |
ceph: fix use-after-free for fsc->mdsc
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>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/mds_client.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index af7221d1c610..590822fab767 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -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); @@ -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: |