diff options
author | Filipe Manana <fdmanana@suse.com> | 2017-04-03 17:57:17 +0300 |
---|---|---|
committer | Filipe Manana <fdmanana@suse.com> | 2017-04-26 18:27:24 +0300 |
commit | be2d253cc98244765323a7c94cc1ac5cd5a17072 (patch) | |
tree | 299a437444b82fec241f9533677782aa49ad0a70 /fs/btrfs | |
parent | 1c81ba237bcecad9bc885a1ddcf02d725ea38482 (diff) | |
download | linux-be2d253cc98244765323a7c94cc1ac5cd5a17072.tar.xz |
Btrfs: fix extent map leak during fallocate error path
If the call to btrfs_qgroup_reserve_data() failed, we were leaking an
extent map structure. The failure can happen either due to an -ENOMEM
condition or, when quotas are enabled, due to -EDQUOT for example.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/file.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 48dfb8e4baf2..56304c400db5 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2856,8 +2856,10 @@ static long btrfs_fallocate(struct file *file, int mode, } ret = btrfs_qgroup_reserve_data(inode, cur_offset, last_byte - cur_offset); - if (ret < 0) + if (ret < 0) { + free_extent_map(em); break; + } } else { /* * Do not need to reserve unwritten extent for this |