summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2006-08-11 22:43:42 +0200
committerAdrian Bunk <bunk@stusta.de>2006-08-11 22:43:42 +0200
commit02ee43fcfd3f10b7416e1402263b6b49853e4e48 (patch)
tree2085511f0f3cb7eef47f3623342a97f4a7706623 /fs
parentdec0370af02c080b1a9c240058a9887fc53a5f08 (diff)
downloadlwn-02ee43fcfd3f10b7416e1402263b6b49853e4e48.tar.gz
lwn-02ee43fcfd3f10b7416e1402263b6b49853e4e48.zip
fix debugfs inode leak
Looking at the reiser4 crash, I found a leak in debugfs. In debugfs_mknod(), we create the inode before checking if the dentry already has one attached. We don't free it if that is the case. Signed-off-by: Jens Axboe <axboe@suse.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/debugfs/inode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index d4f1a2cddd47..d44d24987915 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -67,12 +67,13 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
int mode, dev_t dev)
{
- struct inode *inode = debugfs_get_inode(dir->i_sb, mode, dev);
+ struct inode *inode;
int error = -EPERM;
if (dentry->d_inode)
return -EEXIST;
+ inode = debugfs_get_inode(dir->i_sb, mode, dev);
if (inode) {
d_instantiate(dentry, inode);
dget(dentry);