summaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorXiubo Li <xiubli@redhat.com>2022-03-02 08:29:51 +0100
committerIlya Dryomov <idryomov@gmail.com>2022-03-21 13:35:16 +0100
commit1ad3bb28d336978e451980ca6c72be494b8fe2f1 (patch)
tree6f48f3288c635db7dec66e0d66bf84f886b70546 /fs/ceph
parentceph: fix inode reference leakage in ceph_get_snapdir() (diff)
downloadlinux-1ad3bb28d336978e451980ca6c72be494b8fe2f1.tar.xz
linux-1ad3bb28d336978e451980ca6c72be494b8fe2f1.zip
ceph: assign the ci only when the inode isn't NULL
The ceph_find_inode() may will fail and return NULL. Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/caps.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 991c6c8625b2..f1ad6884d4da 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -4166,7 +4166,6 @@ void ceph_handle_caps(struct ceph_mds_session *session,
/* lookup ino */
inode = ceph_find_inode(mdsc->fsc->sb, vino);
- ci = ceph_inode(inode);
dout(" op %s ino %llx.%llx inode %p\n", ceph_cap_op_name(op), vino.ino,
vino.snap, inode);
@@ -4192,6 +4191,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
}
goto flush_cap_releases;
}
+ ci = ceph_inode(inode);
/* these will work even if we don't have a cap yet */
switch (op) {