Skip to content

Commit

Permalink
btrfs: don't leak ret from do_chunk_alloc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Josef Bacik authored and David Sterba committed Aug 6, 2018
1 parent 84db5cc commit 4559b0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4226,7 +4226,7 @@ int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes)
data_sinfo->flags, bytes, 1);
spin_unlock(&data_sinfo->lock);

return ret;
return 0;
}

int btrfs_check_data_free_space(struct inode *inode,
Expand Down

0 comments on commit 4559b0a

Please sign in to comment.