[PATCH] fs: Fix dentry leak at dentry_open().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't know whether this is a correct fix or not. Please check.
----------------------------------------
>From fa9c553a609cd2aa6703d733ced5e727896ac176 Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 16 Sep 2010 18:37:42 +0900
Subject: [PATCH] fs: Fix dentry leak at dentry_open().

dentry_open() says that it will have done dput(dentry) and mntput(mnt)
if it returns an error. But it was not calling dput(dentry) when mnt == NULL.

Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
---
 fs/open.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/open.c b/fs/open.c
index d74e198..501fda2 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -815,6 +815,7 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags,
 	if (!mnt) {
 		printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__);
 		dump_stack();
+		dput(dentry);
 		return ERR_PTR(-EINVAL);
 	}
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux