1
0
Fork 0

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

[ Upstream commit 9a6bed4fe0 ]

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

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5.4-rM2-2.2.x-imx-squashed
Jeff Layton 2019-12-05 08:41:25 -05:00 committed by Greg Kroah-Hartman
parent 5a5fa88762
commit 379deeac55
1 changed files with 4 additions and 1 deletions

View File

@ -754,8 +754,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