Commit 9a6bed4f authored by Jeff Layton's avatar Jeff Layton Committed by Ilya Dryomov
Browse files

ceph: ensure we have a new cap before continuing in fill_inode



If the caller passes in a NULL cap_reservation, and we can't allocate
one then ensure that we fail gracefully.

Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 57c21994
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -753,8 +753,11 @@ static int fill_inode(struct inode *inode, struct page *locked_page,
	info_caps = le32_to_cpu(info->cap.caps);

	/* prealloc new cap struct */
	if (info_caps && ceph_snap(inode) == CEPH_NOSNAP)
	if (info_caps && ceph_snap(inode) == CEPH_NOSNAP) {
		new_cap = ceph_get_cap(mdsc, caps_reservation);
		if (!new_cap)
			return -ENOMEM;
	}

	/*
	 * prealloc xattr data, if it looks like we'll need it.  only