[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87mu462sv4.fsf@mail.parknet.co.jp>
Date: Sat, 11 Jul 2020 20:28:31 +0900
From: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com,
syzbot <syzbot+756199124937b31a9b7e@...kaller.appspotmail.com>
Subject: [PATCH] fat: Fix fat_ra_init() for data clusters == 0
If data clusters == 0, fat_ra_init() calls the ->ent_blocknr() for the
cluster beyond ->max_clusters.
This checks the limit before initialization to suppress the warning.
Reported-by: syzbot+756199124937b31a9b7e@...kaller.appspotmail.com
Signed-off-by: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
---
fs/fat/fatent.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index bbfe18c..f7e3304 100644
--- a/fs/fat/fatent.c 2020-07-11 19:58:41.903092419 +0900
+++ b/fs/fat/fatent.c 2020-07-11 19:58:51.545948758 +0900
@@ -657,6 +657,9 @@ static void fat_ra_init(struct super_blo
unsigned long ra_pages = sb->s_bdi->ra_pages;
unsigned int reada_blocks;
+ if (fatent->entry >= ent_limit)
+ return;
+
if (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);
_
Powered by blists - more mailing lists