Skip to content

Commit 3ddf1e7

Browse files
Miklos SzerediMiklos Szeredi
authored andcommitted
fuse: fix missing fput on error
Fix the leaking file reference if allocation or initialization of fuse_conn failed. Signed-off-by: Miklos Szeredi <[email protected]> CC: [email protected]
1 parent bb875b3 commit 3ddf1e7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/fuse/inode.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,15 +829,20 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
829829
if (!file)
830830
return -EINVAL;
831831

832-
if (file->f_op != &fuse_dev_operations)
832+
if (file->f_op != &fuse_dev_operations) {
833+
fput(file);
833834
return -EINVAL;
835+
}
834836

835837
fc = kmalloc(sizeof(*fc), GFP_KERNEL);
836-
if (!fc)
838+
if (!fc) {
839+
fput(file);
837840
return -ENOMEM;
841+
}
838842

839843
err = fuse_conn_init(fc, sb);
840844
if (err) {
845+
fput(file);
841846
kfree(fc);
842847
return err;
843848
}

0 commit comments

Comments
 (0)