]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fix debugfs inode leak
authorJens Axboe <axboe@suse.de>
Fri, 11 Aug 2006 20:43:42 +0000 (22:43 +0200)
committerAdrian Bunk <bunk@stusta.de>
Fri, 11 Aug 2006 20:43:42 +0000 (22:43 +0200)
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>
fs/debugfs/inode.c

index d4f1a2cddd47779a9b765316f7c653273d86eace..d44d24987915e3fe00c07c4165a377b90c8fdbc1 100644 (file)
@@ -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);