Skip to content

Commit 4559b0a

Browse files
josefbacikkdave
authored andcommitted
btrfs: don't leak ret from do_chunk_alloc
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: [email protected] # 4.4+ Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 84db5cc commit 4559b0a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/extent-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4226,7 +4226,7 @@ int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes)
42264226
data_sinfo->flags, bytes, 1);
42274227
spin_unlock(&data_sinfo->lock);
42284228

4229-
return ret;
4229+
return 0;
42304230
}
42314231

42324232
int btrfs_check_data_free_space(struct inode *inode,

0 commit comments

Comments
 (0)