ceph: fix null pointer dereference in ceph_flush_snaps()
authorYan, Zheng <zyan@redhat.com>
Thu, 4 Aug 2016 00:43:33 +0000 (08:43 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 8 Aug 2016 19:41:43 +0000 (21:41 +0200)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
fs/ceph/caps.c

index 99115cae1652ac1661d37a5a286da7180b6d9d94..16e6ded0b7f281bf72e8074b9d2896713fe4aef2 100644 (file)
@@ -1347,9 +1347,12 @@ void ceph_flush_snaps(struct ceph_inode_info *ci,
 {
        struct inode *inode = &ci->vfs_inode;
        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;
+
        dout("ceph_flush_snaps %p\n", inode);
+       if (psession)
+               session = *psession;
 retry:
        spin_lock(&ci->i_ceph_lock);
        if (!(ci->i_ceph_flags & CEPH_I_FLUSH_SNAPS)) {