Skip to content

Commit 9a6bed4

Browse files
jtlaytonidryomov
authored andcommitted
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: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 57c2199 commit 9a6bed4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎fs/ceph/inode.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,11 @@ static int fill_inode(struct inode *inode, struct page *locked_page,
753753
info_caps = le32_to_cpu(info->cap.caps);
754754

755755
/* prealloc new cap struct */
756-
if (info_caps && ceph_snap(inode) == CEPH_NOSNAP)
756+
if (info_caps && ceph_snap(inode) == CEPH_NOSNAP) {
757757
new_cap = ceph_get_cap(mdsc, caps_reservation);
758+
if (!new_cap)
759+
return -ENOMEM;
760+
}
758761

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

0 commit comments

Comments
 (0)