Skip to content

Commit

Permalink
pstore: fix leaking ->i_private
Browse files Browse the repository at this point in the history
Move kfree() of i_private out of ->unlink() and into ->evict_inode()

Signed-off-by: Tony Luck <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
aegl authored and Al Viro committed Mar 21, 2011
1 parent b7ed78f commit a872d51
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fs/pstore/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry)
struct pstore_private *p = dentry->d_inode->i_private;

p->erase(p->id);
kfree(p);

return simple_unlink(dir, dentry);
}

static void pstore_evict_inode(struct inode *inode)
{
end_writeback(inode);
kfree(inode->i_private);
}

static const struct inode_operations pstore_dir_inode_operations = {
.lookup = simple_lookup,
.unlink = pstore_unlink,
Expand Down Expand Up @@ -110,6 +115,7 @@ static struct inode *pstore_get_inode(struct super_block *sb,
static const struct super_operations pstore_ops = {
.statfs = simple_statfs,
.drop_inode = generic_delete_inode,
.evict_inode = pstore_evict_inode,
.show_options = generic_show_options,
};

Expand Down

0 comments on commit a872d51

Please sign in to comment.