Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Geert Uytterhoeven and committed by
Ilya Dryomov
31ca5878 f72f9455

+2
+2
fs/ceph/super.c
··· 845 845 err = ceph_fs_debugfs_init(fsc); 846 846 if (err < 0) 847 847 goto fail; 848 + } else { 849 + root = dget(fsc->sb->s_root); 848 850 } 849 851 850 852 fsc->mount_state = CEPH_MOUNT_MOUNTED;