Skip to content

Commit a7caa88

Browse files
lxbszidryomov
authored andcommitted
ceph: fix use-after-free for fsc->mdsc
If the ceph_mdsc_init() fails, it will free the mdsc already. Reported-by: [email protected] Signed-off-by: Xiubo Li <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 8e298de commit a7caa88

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/ceph/mds_client.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4453,7 +4453,6 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
44534453
goto err_mdsc;
44544454
}
44554455

4456-
fsc->mdsc = mdsc;
44574456
init_completion(&mdsc->safe_umount_waiters);
44584457
init_waitqueue_head(&mdsc->session_close_wq);
44594458
INIT_LIST_HEAD(&mdsc->waiting_for_map);
@@ -4508,6 +4507,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
45084507

45094508
strscpy(mdsc->nodename, utsname()->nodename,
45104509
sizeof(mdsc->nodename));
4510+
4511+
fsc->mdsc = mdsc;
45114512
return 0;
45124513

45134514
err_mdsmap:

0 commit comments

Comments
 (0)