mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
btrfs: fix page leaks after failure to lock page for delalloc
commit 5909ca110b 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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2fae5cc5af
commit
bf93dda2fd
@@ -1707,7 +1707,8 @@ static int __process_pages_contig(struct address_space *mapping,
|
||||
if (!PageDirty(pages[i]) ||
|
||||
pages[i]->mapping != mapping) {
|
||||
unlock_page(pages[i]);
|
||||
put_page(pages[i]);
|
||||
for (; i < ret; i++)
|
||||
put_page(pages[i]);
|
||||
err = -EAGAIN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user