Commit 3ddf1e7f authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Miklos Szeredi

fuse: fix missing fput on error

Fix the leaking file reference if allocation or initialization of
fuse_conn failed.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
CC: stable@kernel.org
parent bb875b38
...@@ -829,15 +829,20 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) ...@@ -829,15 +829,20 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
if (!file) if (!file)
return -EINVAL; return -EINVAL;
if (file->f_op != &fuse_dev_operations) if (file->f_op != &fuse_dev_operations) {
fput(file);
return -EINVAL; return -EINVAL;
}
fc = kmalloc(sizeof(*fc), GFP_KERNEL); fc = kmalloc(sizeof(*fc), GFP_KERNEL);
if (!fc) if (!fc) {
fput(file);
return -ENOMEM; return -ENOMEM;
}
err = fuse_conn_init(fc, sb); err = fuse_conn_init(fc, sb);
if (err) { if (err) {
fput(file);
kfree(fc); kfree(fc);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment