linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fat: Avoid oops when bdi->io_pages==0
@ 2020-08-30  0:59 OGAWA Hirofumi
  2020-08-30  1:21 ` Matthew Wilcox
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: OGAWA Hirofumi @ 2020-08-30  0:59 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-fsdevel

On one system, there was bdi->io_pages==0. This seems to be the bug of
a driver somewhere, and should fix it though. Anyway, it is better to
avoid the divide-by-zero Oops.

So this check it.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: <stable@vger.kernel.org>
---
 fs/fat/fatent.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index f7e3304..98a1c4f 100644
--- a/fs/fat/fatent.c	2020-08-30 06:52:47.251564566 +0900
+++ b/fs/fat/fatent.c	2020-08-30 06:54:05.838319213 +0900
@@ -660,7 +660,7 @@ static void fat_ra_init(struct super_blo
 	if (fatent->entry >= ent_limit)
 		return;
 
-	if (ra_pages > sb->s_bdi->io_pages)
+	if (sb->s_bdi->io_pages && ra_pages > sb->s_bdi->io_pages)
 		ra_pages = rounddown(ra_pages, sb->s_bdi->io_pages);
 	reada_blocks = ra_pages << (PAGE_SHIFT - sb->s_blocksize_bits + 1);
 
_

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-08-31 17:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-30  0:59 [PATCH] fat: Avoid oops when bdi->io_pages==0 OGAWA Hirofumi
2020-08-30  1:21 ` Matthew Wilcox
2020-08-30  1:54   ` OGAWA Hirofumi
2020-08-30  3:53     ` Matthew Wilcox
2020-08-30  9:04       ` OGAWA Hirofumi
2020-08-30 14:01 ` Sasha Levin
2020-08-30 14:16   ` OGAWA Hirofumi
2020-08-31 15:22 ` Jens Axboe
2020-08-31 16:37   ` OGAWA Hirofumi
2020-08-31 16:39     ` Jens Axboe
2020-08-31 16:56       ` Matthew Wilcox
2020-08-31 17:00         ` Jens Axboe
2020-08-31 17:39           ` OGAWA Hirofumi
2020-08-31 17:16       ` OGAWA Hirofumi
2020-08-31 17:19         ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).