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
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 47c96fd..6893717 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -829,15 +829,20 @@
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;
}