ceph: quota: fix null pointer dereference in quota check
[sfrench/cifs-2.6.git] / fs / ceph / quota.c
index 32d4f13784ba5da85e420a565297eff6b3bf132a..03f4d24db8fe009dc4384b83162979c34f11d1e0 100644 (file)
@@ -237,7 +237,8 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
                ceph_put_snap_realm(mdsc, realm);
                realm = next;
        }
-       ceph_put_snap_realm(mdsc, realm);
+       if (realm)
+               ceph_put_snap_realm(mdsc, realm);
        up_read(&mdsc->snap_rwsem);
 
        return exceeded;