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
@@ -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);
+ }
fc = kmalloc(sizeof(*fc), GFP_KERNEL);
- if (!fc)
+ if (!fc) {
return -ENOMEM;
err = fuse_conn_init(fc, sb);
if (err) {
kfree(fc);
return err;
}