From: Geert Uytterhoeven Date: Thu, 13 Oct 2016 15:15:37 +0000 (+0200) Subject: ceph: fix uninitialized dentry pointer in ceph_real_mount() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=31ca58781019de191c7f520f0626ca76a88c1f6e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Yan, Zheng --- 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;