diff mbox

ceph: fix dentry leak in splice_dentry()

Message ID 20180620021839.6109-1-zyan@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yan, Zheng June 20, 2018, 2:18 a.m. UTC
In any case, d_splice_alias() does not drop reference of original dentry.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
---
 fs/ceph/inode.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jeff Layton June 20, 2018, 9:59 a.m. UTC | #1
On Wed, 2018-06-20 at 10:18 +0800, Yan, Zheng wrote:
> In any case, d_splice_alias() does not drop reference of original dentry.
> 
> Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
> ---
>  fs/ceph/inode.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> index 4cd1b7da755e..4cf7253520cf 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -1140,6 +1140,7 @@ 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 */
>  		goto out;
>  	} else if (realdn) {

Reviewed-by: Jeff Layton <jlayton@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 4cd1b7da755e..4cf7253520cf 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -1140,6 +1140,7 @@  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 */
 		goto out;
 	} else if (realdn) {