From: Josef Bacik Date: Thu, 19 Jul 2018 14:49:51 +0000 (-0400) Subject: btrfs: don't leak ret from do_chunk_alloc X-Git-Tag: v4.14.68~76 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e7457f97d2af26bfdda028b691bc11363296b3a9;p=users%2Fjedix%2Flinux-maple.git btrfs: don't leak ret from do_chunk_alloc commit 4559b0a71749c442d34f7cfb9e72c9e58db83948 upstream. 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 Reviewed-by: Nikolay Borisov Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 53487102081d6..bbabe37c2e8cd 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4407,7 +4407,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,