Commit cdca8d0c authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] possible of memory leak of driverfs_mknod()

This patch fixes memory leak of driverfs_mknod(), and changes odd
error code.
parent 3334a8ca
......@@ -130,14 +130,15 @@ struct inode *driverfs_get_inode(struct super_block *sb, int mode, int dev)
static int driverfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int dev)
{
struct inode *inode = driverfs_get_inode(dir->i_sb, mode, dev);
int error = -EPERM;
struct inode *inode;
int error = -ENOSPC;
if (dentry->d_inode)
return -EEXIST;
/* only allow create if ->d_fsdata is not NULL (so we can assume it
* comes from the driverfs API below. */
inode = driverfs_get_inode(dir->i_sb, mode, dev);
if (inode) {
d_instantiate(dentry, inode);
dget(dentry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment