fuse: fix missing fput on error

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
This commit is contained in:
Miklos Szeredi 2009-01-26 15:00:58 +01:00 committed by Miklos Szeredi
parent bb875b38dc
commit 3ddf1e7f57
1 changed files with 7 additions and 2 deletions

View File

@ -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;
}