mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cyril Roelandt <tipecaml@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org,
	Cyril Roelandt <tipecaml@gmail.com>,
	sage@inktank.com, ceph-devel@vger.kernel.org
Subject: [PATCH 3/3] ceph: fix dentry reference leak in ceph_encode_fh().
Date: Sun, 11 Nov 2012 21:49:31 +0100	[thread overview]
Message-ID: <1352666971-13551-4-git-send-email-tipecaml@gmail.com> (raw)
In-Reply-To: <1352666971-13551-1-git-send-email-tipecaml@gmail.com>

dput() was not called in the error path.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
---
 fs/ceph/export.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 9349bb3..ca3ab3f 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -56,13 +56,15 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
 	struct ceph_nfs_confh *cfh = (void *)rawfh;
 	int connected_handle_length = sizeof(*cfh)/4;
 	int handle_length = sizeof(*fh)/4;
-	struct dentry *dentry = d_find_alias(inode);
+	struct dentry *dentry;
 	struct dentry *parent;
 
 	/* don't re-export snaps */
 	if (ceph_snap(inode) != CEPH_NOSNAP)
 		return -EINVAL;
 
+	dentry = d_find_alias(inode);
+
 	/* if we found an alias, generate a connectable fh */
 	if (*max_len >= connected_handle_length && dentry) {
 		dout("encode_fh %p connectable\n", dentry);
-- 
1.7.10.4


  parent reply	other threads:[~2012-11-11 20:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-11 20:49 [PATCH 0/3] Use dput() after d_find_alias() Cyril Roelandt
2012-11-11 20:49 ` [PATCH 1/3] Coccinelle: Add api/d_find_alias.cocci Cyril Roelandt
2012-11-11 20:49 ` [PATCH 2/3] iommu/tegra-smmu.c: fix dentry reference leak in smmu_debugfs_stats_show() Cyril Roelandt
2012-11-12  7:39   ` Hiroshi Doyu
2012-11-17 12:26   ` Joerg Roedel
2012-11-11 20:49 ` Cyril Roelandt [this message]
2012-11-20 16:21   ` [PATCH 3/3] ceph: fix dentry reference leak in ceph_encode_fh() Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1352666971-13551-4-git-send-email-tipecaml@gmail.com \
    --to=tipecaml@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sage@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome