ACK: [SRU] [Xenial] [PATCH 1/1] Btrfs: fix extent map leak during fallocate error path
Colin Ian King
colin.king at canonical.com
Wed Apr 3 12:48:51 UTC 2019
On 03/04/2019 13:38, Andrea Righi wrote:
> From: Filipe Manana <fdmanana at suse.com>
>
> BugLink: https://bugs.launchpad.net/bugs/1822579
>
> 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 at suse.com>
> Reviewed-by: David Sterba <dsterba at suse.com>
> (backported from commit be2d253cc98244765323a7c94cc1ac5cd5a17072)
> Signed-off-by: Andrea Righi <andrea.righi at canonical.com>
> ---
> fs/btrfs/file.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index 751fcc6..743ad5e 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -2763,8 +2763,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;
> + }
> }
> free_extent_map(em);
> cur_offset = last_byte;
>
Looks good to me; sane upstream fix and positive test results.
Acked-by: Colin Ian King <colin.king at canonical.com>
More information about the kernel-team
mailing list