diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2016-10-13 17:15:37 +0200 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-10-18 12:10:59 +0200 |
commit | 31ca58781019de191c7f520f0626ca76a88c1f6e (patch) | |
tree | 1cd859a416764babfed2f248a4edf3d26674d134 /fs/ceph | |
parent | ceph: fix readdir vs fragmentation race (diff) | |
download | linux-31ca58781019de191c7f520f0626ca76a88c1f6e.tar.xz linux-31ca58781019de191c7f520f0626ca76a88c1f6e.zip |
ceph: fix uninitialized dentry pointer in ceph_real_mount()
fs/ceph/super.c: In function ‘ceph_real_mount’:
fs/ceph/super.c:818: warning: ‘root’ may be used uninitialized in this function
If s_root is already valid, dentry pointer root is never initialized,
and returned by ceph_real_mount(). This will cause a crash later when
the caller dereferences the pointer.
Fixes: ce2728aaa82bbeba ("ceph: avoid accessing / when mounting a subpath")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/super.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index a29ffce98187..b382e5910eea 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -845,6 +845,8 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc) err = ceph_fs_debugfs_init(fsc); if (err < 0) goto fail; + } else { + root = dget(fsc->sb->s_root); } fsc->mount_state = CEPH_MOUNT_MOUNTED; |