]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
fuse: fix missing fput on error
authorMiklos Szeredi <mszeredi@suse.cz>
Mon, 26 Jan 2009 14:00:58 +0000 (15:00 +0100)
committerMiklos Szeredi <mszeredi@suse.de>
Mon, 26 Jan 2009 14:00:58 +0000 (15:00 +0100)
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
fs/fuse/inode.c

index 47c96fdca1ac69afbf7f7eb841a9a50690754ee7..6893717b6536271459e89f7003d5c4c9dbe7bac2 100644 (file)
@@ -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;
        }