aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2009-01-26 09:00:58 -0500
committerMiklos Szeredi <mszeredi@suse.de>2009-01-26 09:00:58 -0500
commit3ddf1e7f57237ac7c5d5bfb7058f1ea4f970b661 (patch)
tree2a1761f7bcd44a2474f34ff6590f7fe95f396732 /fs/fuse
parentbb875b38dc5e343bdb696b2eab8233e4d195e208 (diff)
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')
-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)
829 if (!file) 829 if (!file)
830 return -EINVAL; 830 return -EINVAL;
831 831
832 if (file->f_op != &fuse_dev_operations) 832 if (file->f_op != &fuse_dev_operations) {
833 fput(file);
833 return -EINVAL; 834 return -EINVAL;
835 }
834 836
835 fc = kmalloc(sizeof(*fc), GFP_KERNEL); 837 fc = kmalloc(sizeof(*fc), GFP_KERNEL);
836 if (!fc) 838 if (!fc) {
839 fput(file);
837 return -ENOMEM; 840 return -ENOMEM;
841 }
838 842
839 err = fuse_conn_init(fc, sb); 843 err = fuse_conn_init(fc, sb);
840 if (err) { 844 if (err) {
845 fput(file);
841 kfree(fc); 846 kfree(fc);
842 return err; 847 return err;
843 } 848 }