From: Jens Axboe Date: Fri, 11 Aug 2006 20:43:42 +0000 (+0200) Subject: fix debugfs inode leak X-Git-Tag: v2.6.16.28-rc1~4 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=02ee43fcfd3f10b7416e1402263b6b49853e4e48;p=karo-tx-linux.git 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 Signed-off-by: Adrian Bunk --- 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);