btrfs: don't leak ret from do_chunk_alloc
authorJosef Bacik <josef@toxicpanda.com>
Thu, 19 Jul 2018 14:49:51 +0000 (10:49 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 6 Aug 2018 11:12:59 +0000 (13:12 +0200)
If we're trying to make a data reservation and we have to allocate a
data chunk we could leak ret == 1, as do_chunk_alloc() will return 1 if
it allocated a chunk.  Since the end of the function is the success path
just return 0.

CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c

index 16b916a..2eb2d7a 100644 (file)
@@ -4226,7 +4226,7 @@ commit_trans:
                                      data_sinfo->flags, bytes, 1);
        spin_unlock(&data_sinfo->lock);
 
-       return ret;
+       return 0;
 }
 
 int btrfs_check_data_free_space(struct inode *inode,