diff options
author | Xiubo Li <xiubli@redhat.com> | 2020-07-23 15:32:25 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-08-26 10:40:56 +0200 |
commit | 2bd8ba398fadcebe77626a616b0d11467af817f7 (patch) | |
tree | 662c6c081c6e333274d37562d42af9d82d310b36 /fs/ceph | |
parent | 2524bb04d81be1ac1b2152f09b885cef6e3271f8 (diff) | |
download | linux-stable-2bd8ba398fadcebe77626a616b0d11467af817f7.tar.gz linux-stable-2bd8ba398fadcebe77626a616b0d11467af817f7.tar.bz2 linux-stable-2bd8ba398fadcebe77626a616b0d11467af817f7.zip |
ceph: fix use-after-free for fsc->mdsc
[ Upstream commit a7caa88f8b72c136f9a401f498471b8a8e35370d ]
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>
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 701bc3f4d4ba..b0077f5a3168 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -4143,7 +4143,6 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) return -ENOMEM; } - fsc->mdsc = mdsc; init_completion(&mdsc->safe_umount_waiters); init_waitqueue_head(&mdsc->session_close_wq); INIT_LIST_HEAD(&mdsc->waiting_for_map); @@ -4195,6 +4194,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) strscpy(mdsc->nodename, utsname()->nodename, sizeof(mdsc->nodename)); + + fsc->mdsc = mdsc; return 0; } |