Skip to contentSkip to conversation

debugfs inode leak

PATCH New Jens Axboe 1 participant 1 message Jun 8, 2006 Driver core

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

PATCH 1/1 debugfs inode leak

Hi,

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.

These bugs happen quite often, I'm starting to think we should disallow such coding in CodingStyle.

fs/debugfs/inode.c +2 -1
index 85d166c..b55b4ea 100644
@@ -67,12 +67,13 @@ static struct inode *debugfs_get_inode(s
 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);
Signature · 1 line
Jens Axboe