[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200824082414.791473408@linuxfoundation.org>
Date: Mon, 24 Aug 2020 10:28:35 +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,
Nicolas Prochazka <nicolas.prochazka@...il.com>,
Tomoatsu Shimada <shimada@...brix.com>,
Phillip Lougher <phillip@...ashfs.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Guenter Roeck <groeck@...omium.org>,
Philippe Liard <pliard@...gle.com>,
Christoph Hellwig <hch@....de>,
Adrien Schildknecht <adrien+dev@...ischi.me>,
Daniel Rosenberg <drosen@...gle.com>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH 5.8 017/148] squashfs: avoid bio_alloc() failure with 1Mbyte blocks
From: Phillip Lougher <phillip@...ashfs.org.uk>
commit f26044c83e6e473a61917f5db411d1417327d425 upstream.
This is a regression introduced by the patch "migrate from ll_rw_block
usage to BIO".
Bio_alloc() is limited to 256 pages (1 Mbyte). This can cause a failure
when reading 1 Mbyte block filesystems. The problem is a datablock can be
fully (or almost uncompressed), requiring 256 pages, but, because blocks
are not aligned to page boundaries, it may require 257 pages to read.
Bio_kmalloc() can handle 1024 pages, and so use this for the edge
condition.
Fixes: 93e72b3c612a ("squashfs: migrate from ll_rw_block usage to BIO")
Reported-by: Nicolas Prochazka <nicolas.prochazka@...il.com>
Reported-by: Tomoatsu Shimada <shimada@...brix.com>
Signed-off-by: Phillip Lougher <phillip@...ashfs.org.uk>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Reviewed-by: Guenter Roeck <groeck@...omium.org>
Cc: Philippe Liard <pliard@...gle.com>
Cc: Christoph Hellwig <hch@....de>
Cc: Adrien Schildknecht <adrien+dev@...ischi.me>
Cc: Daniel Rosenberg <drosen@...gle.com>
Cc: <stable@...r.kernel.org>
Link: http://lkml.kernel.org/r/20200815035637.15319-1-phillip@squashfs.org.uk
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/squashfs/block.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/fs/squashfs/block.c
+++ b/fs/squashfs/block.c
@@ -87,7 +87,11 @@ static int squashfs_bio_read(struct supe
int error, i;
struct bio *bio;
- bio = bio_alloc(GFP_NOIO, page_count);
+ if (page_count <= BIO_MAX_PAGES)
+ bio = bio_alloc(GFP_NOIO, page_count);
+ else
+ bio = bio_kmalloc(GFP_NOIO, page_count);
+
if (!bio)
return -ENOMEM;
Powered by blists - more mailing lists