[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200727134912.046122358@linuxfoundation.org>
Date: Mon, 27 Jul 2020 16:03:59 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Filipe Manana <fdmanana@...e.com>,
Nikolay Borisov <nborisov@...e.com>,
Robbie Ko <robbieko@...ology.com>,
David Sterba <dsterba@...e.com>
Subject: [PATCH 4.14 20/64] btrfs: fix page leaks after failure to lock page for delalloc
From: Robbie Ko <robbieko@...ology.com>
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@...r.kernel.org # 4.14+
Reviewed-by: Filipe Manana <fdmanana@...e.com>
Reviewed-by: Nikolay Borisov <nborisov@...e.com>
Signed-off-by: Robbie Ko <robbieko@...ology.com>
Reviewed-by: David Sterba <dsterba@...e.com>
Signed-off-by: David Sterba <dsterba@...e.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/btrfs/extent_io.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1721,7 +1721,8 @@ static int __process_pages_contig(struct
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;
}
Powered by blists - more mailing lists