From: Yan, Zheng Date: Thu, 27 Sep 2018 13:16:05 +0000 (+0800) Subject: Revert "ceph: fix dentry leak in splice_dentry()" X-Git-Tag: v4.18.20~103 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb34fbacd90ca34cc2f73844fbad5ebcd4a11a85;p=thirdparty%2Fkernel%2Fstable.git Revert "ceph: fix dentry leak in splice_dentry()" commit efe328230dc01aa0b1269aad0b5fae73eea4677a upstream. This reverts commit 8b8f53af1ed9df88a4c0fbfdf3db58f62060edf3. splice_dentry() is used by three places. For two places, req->r_dentry is passed to splice_dentry(). In the case of error, req->r_dentry does not get updated. So splice_dentry() should not drop reference. Cc: stable@vger.kernel.org # 4.18+ Signed-off-by: "Yan, Zheng" Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index a866be999216a..4b1eda26480b8 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -1135,8 +1135,12 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in) if (IS_ERR(realdn)) { pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", PTR_ERR(realdn), dn, in, ceph_vinop(in)); - dput(dn); - dn = realdn; /* note realdn contains the error */ + dn = realdn; + /* + * Caller should release 'dn' in the case of error. + * If 'req->r_dentry' is passed to this function, + * caller should leave 'req->r_dentry' untouched. + */ goto out; } else if (realdn) { dout("dn %p (%d) spliced with %p (%d) "