summaryrefslogtreecommitdiffstats
path: root/fs/fuse/inode.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2009-01-26 15:00:58 +0100
committerMiklos Szeredi <mszeredi@suse.de>2009-01-26 15:00:58 +0100
commit3ddf1e7f57237ac7c5d5bfb7058f1ea4f970b661 (patch)
tree2a1761f7bcd44a2474f34ff6590f7fe95f396732 /fs/fuse/inode.c
parentfuse: fix NULL deref in fuse_file_alloc() (diff)
downloadlinux-3ddf1e7f57237ac7c5d5bfb7058f1ea4f970b661.tar.xz
linux-3ddf1e7f57237ac7c5d5bfb7058f1ea4f970b661.zip
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
Diffstat (limited to 'fs/fuse/inode.c')
-rw-r--r--fs/fuse/inode.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 47c96fdca1ac..6893717b6536 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -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;
}