Browse Source

ceph: fix null pointer dereference in ceph_flush_snaps()

Signed-off-by: Yan, Zheng <zyan@redhat.com>
Yan, Zheng 9 years ago
parent
commit
e4d2b16a44
1 changed files with 4 additions and 1 deletions
  1. 4 1
      fs/ceph/caps.c

+ 4 - 1
fs/ceph/caps.c

@@ -1347,9 +1347,12 @@ void ceph_flush_snaps(struct ceph_inode_info *ci,
 {
 {
 	struct inode *inode = &ci->vfs_inode;
 	struct inode *inode = &ci->vfs_inode;
 	struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
 	struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
-	struct ceph_mds_session *session = *psession;
+	struct ceph_mds_session *session = NULL;
 	int mds;
 	int mds;
+
 	dout("ceph_flush_snaps %p\n", inode);
 	dout("ceph_flush_snaps %p\n", inode);
+	if (psession)
+		session = *psession;
 retry:
 retry:
 	spin_lock(&ci->i_ceph_lock);
 	spin_lock(&ci->i_ceph_lock);
 	if (!(ci->i_ceph_flags & CEPH_I_FLUSH_SNAPS)) {
 	if (!(ci->i_ceph_flags & CEPH_I_FLUSH_SNAPS)) {