ceph: fix inode reference leakage in ceph_get_snapdir()
authorXiubo Li <xiubli@redhat.com>
Wed, 2 Mar 2022 06:51:53 +0000 (14:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Apr 2022 18:59:10 +0000 (20:59 +0200)
commit3ae7163598c611a8892698e0c056fe794e52b44b
tree9725317a5661ee958e95837997419e935ec6916f
parenteb0e7173d9cbbcb30acdbef8add489a8705e742a
ceph: fix inode reference leakage in ceph_get_snapdir()

[ Upstream commit 322794d3355c33adcc4feace0045d85a8e4ed813 ]

The ceph_get_inode() will search for or insert a new inode into the
hash for the given vino, and return a reference to it. If new is
non-NULL, its reference is consumed.

We should release the reference when in error handing cases.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ceph/inode.c