Skip to content

Commit

Permalink
fuse: fix missing fput on error
Browse files Browse the repository at this point in the history
Fix the leaking file reference if allocation or initialization of
fuse_conn failed.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
CC: stable@kernel.org
  • Loading branch information
Miklos Szeredi authored and Miklos Szeredi committed Jan 26, 2009
1 parent bb875b3 commit 3ddf1e7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,15 +829,20 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
if (!file)
return -EINVAL;

if (file->f_op != &fuse_dev_operations)
if (file->f_op != &fuse_dev_operations) {
fput(file);
return -EINVAL;
}

fc = kmalloc(sizeof(*fc), GFP_KERNEL);
if (!fc)
if (!fc) {
fput(file);
return -ENOMEM;
}

err = fuse_conn_init(fc, sb);
if (err) {
fput(file);
kfree(fc);
return err;
}
Expand Down

0 comments on commit 3ddf1e7

Please sign in to comment.