Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp102617pxk; Sat, 29 Aug 2020 18:09:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyphl2QyJ+skliTbSHvWYt+XZUTyW80zcAnwKstS4iTZFVoPqxr2YQoVpSRxe7NLrUlXgYP X-Received: by 2002:a17:906:7204:: with SMTP id m4mr5602936ejk.342.1598749778642; Sat, 29 Aug 2020 18:09:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598749778; cv=none; d=google.com; s=arc-20160816; b=ZnKRH+UFUSSelw2rckkDpsHRSJW5EVUy+tpFdEm8exk36pSqIKY6Fx9gYZEZzImjZI 1Fy9vrPSDrO6o73c7srwKABrwvHbMVUwRxIIUgRBX3it+AS3vg/+nazL3ccgANyWxS4l a6eEeOutkOIPDPUJU2NTokV9BW0teUTD0FGZeNX733lkzQwSnRkbkDMJy/7jjJ9v00XZ ckWWETRKrP5HCppA9VhSfnyR2p3Lmbjj22Ym8uJp6Leazle5odLLwuwZjvVuolh7HzRF HRDNwhWiLsffTVpxJxCHc6EvnacH1/XZqTK53sDYgoBJuoFZ3V4mlsyeIZaw1LkaxWE8 wXXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id:date :subject:cc:to:from; bh=0+GGedwnndwsugaMSLovMUtwhmD6svOo5TUBSwjikj8=; b=CVOx0b6Z9TGsG5OqxoRQXCBXco7uMYsdQKd2v92OVxtIokPRmsbm2BOiZQwIl1guLt Ydfl6kiLFmiXMbXE4g5CaAeafgO4MxYuJqSu5s0tHPuYZ+UXWsrBcjr3uaSh6ag7kBll 8c8NhmcRFPOXA7HSTsDTVn41gP7T2r/o88uBsuv34zkRAEBEH67hCAgL29EtAoVVw+1K pMyIMNNOwzKMeV8UO/NeJjktPePBBsZJ5XFNu3asHLYnzne/JA2XPEqD01qaKpWj3afT arMqztbclAzkHzmTfV+iJ57peWqGXTwnYUWPa9mfVZzq7+jyTgPt+UBXeyoa+xY1X2zw xPeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w19si2478075eds.303.2020.08.29.18.09.15; Sat, 29 Aug 2020 18:09:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728577AbgH3BIk (ORCPT + 99 others); Sat, 29 Aug 2020 21:08:40 -0400 Received: from mail.parknet.co.jp ([210.171.160.6]:33438 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728246AbgH3BIj (ORCPT ); Sat, 29 Aug 2020 21:08:39 -0400 X-Greylist: delayed 536 seconds by postgrey-1.27 at vger.kernel.org; Sat, 29 Aug 2020 21:08:39 EDT Received: from ibmpc.myhome.or.jp (server.parknet.ne.jp [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTPSA id 1FDB81B44DF; Sun, 30 Aug 2020 09:59:43 +0900 (JST) Received: from devron.myhome.or.jp (foobar@devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (8.15.2/8.15.2/Debian-20) with ESMTPS id 07U0xf8Y321806 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sun, 30 Aug 2020 09:59:42 +0900 Received: from devron.myhome.or.jp (foobar@localhost [127.0.0.1]) by devron.myhome.or.jp (8.15.2/8.15.2/Debian-20) with ESMTPS id 07U0xf0f3060830 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sun, 30 Aug 2020 09:59:41 +0900 Received: (from hirofumi@localhost) by devron.myhome.or.jp (8.15.2/8.15.2/Submit) id 07U0xfPW3060829; Sun, 30 Aug 2020 09:59:41 +0900 From: OGAWA Hirofumi To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH] fat: Avoid oops when bdi->io_pages==0 Date: Sun, 30 Aug 2020 09:59:41 +0900 Message-ID: <87ft85osn6.fsf@mail.parknet.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: --- 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