提交 71601e2b 编写于 作者: J Jens Axboe 提交者: Linus Torvalds

[PATCH] 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.

These bugs happen quite often, I'm starting to think we should disallow
such coding in CodingStyle.
Signed-off-by: NJens Axboe <axboe@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 bc1c1169
...@@ -67,12 +67,13 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d ...@@ -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, static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
int mode, dev_t dev) int mode, dev_t dev)
{ {
struct inode *inode = debugfs_get_inode(dir->i_sb, mode, dev); struct inode *inode;
int error = -EPERM; int error = -EPERM;
if (dentry->d_inode) if (dentry->d_inode)
return -EEXIST; return -EEXIST;
inode = debugfs_get_inode(dir->i_sb, mode, dev);
if (inode) { if (inode) {
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
dget(dentry); dget(dentry);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册