lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b4e1f741-989c-6c9d-b559-4c1ada88c499@kernel.dk>
Date:   Mon, 31 Aug 2020 09:22:15 -0600
From:   Jens Axboe <axboe@...nel.dk>
To:     OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH] fat: Avoid oops when bdi->io_pages==0

On Sat, Aug 29, 2020 at 7:08 PM OGAWA Hirofumi <hirofumi@...l.parknet.co.jp> wrote:
>
> 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@...l.parknet.co.jp>
> Cc: <stable@...r.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);

I don't think we should work-around this here. What device is this on?
Something like the below may help.

diff --git a/block/blk-core.c b/block/blk-core.c
index d9d632639bd1..10c08ac50697 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -539,6 +539,7 @@ struct request_queue *blk_alloc_queue(int node_id)
 		goto fail_stats;
 
 	q->backing_dev_info->ra_pages = VM_READAHEAD_PAGES;
+	q->backing_dev_info->io_pages = VM_READAHEAD_PAGES;
 	q->backing_dev_info->capabilities = BDI_CAP_CGROUP_WRITEBACK;
 	q->node = node_id;

-- 
Jens Axboe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ