فهرست منبع

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>
Geert Uytterhoeven 8 سال پیش
والد
کامیت
31ca587810
1فایلهای تغییر یافته به همراه2 افزوده شده و 0 حذف شده
  1. 2 0
      fs/ceph/super.c

+ 2 - 0
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);
 		err = ceph_fs_debugfs_init(fsc);
 		if (err < 0)
 		if (err < 0)
 			goto fail;
 			goto fail;
+	} else {
+		root = dget(fsc->sb->s_root);
 	}
 	}
 
 
 	fsc->mount_state = CEPH_MOUNT_MOUNTED;
 	fsc->mount_state = CEPH_MOUNT_MOUNTED;