btrfs: fix page leaks after failure to lock page for delalloc
authorRobbie Ko <robbieko@synology.com>
Mon, 20 Jul 2020 01:42:09 +0000 (09:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jul 2020 08:19:40 +0000 (10:19 +0200)
commit70b8d693ddc9d9f7291e7607038d16e80b959acc
tree10a5661a020059e03bd47f75216901254c98eec3
parent699e71192e196c6c4a73a0b8afdaab93d60b6fc7
btrfs: fix page leaks after failure to lock page for delalloc

commit 5909ca110b29aa16b23b52b8de8d3bb1035fd738 upstream.

When locking pages for delalloc, we check if it's dirty and mapping still
matches. If it does not match, we need to return -EAGAIN and release all
pages. Only the current page was put though, iterate over all the
remaining pages too.

CC: stable@vger.kernel.org # 4.14+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Robbie Ko <robbieko@synology.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/extent_io.c