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: <20230710154803.00004047.zbestahu@gmail.com>
Date:   Mon, 10 Jul 2023 15:48:03 +0800
From:   Yue Hu <zbestahu@...il.com>
To:     Chunhai Guo <guochunhai@...o.com>
Cc:     xiang@...nel.org, chao@...nel.org, linux-erofs@...ts.ozlabs.org,
        linux-kernel@...r.kernel.org, huyue2@...lpad.com
Subject: Re: [PATCH] erofs: avoid unnecessary loops in
 z_erofs_pcluster_readmore() when read page beyond EOF

On Mon, 10 Jul 2023 12:25:31 +0800
Chunhai Guo <guochunhai@...o.com> wrote:

> z_erofs_pcluster_readmore() may take a long time to loop when the page
> offset is large enough, which is unnecessary should be prevented.
> For example, when the following case is encountered, it will loop 4691368
> times, taking about 27 seconds.
>     - offset = 19217289215
>     - inode_size = 1442672
> 
> Signed-off-by: Chunhai Guo <guochunhai@...o.com>
> ---
>  fs/erofs/zdata.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
> index 5f1890e309c6..d9a0763f4595 100644
> --- a/fs/erofs/zdata.c
> +++ b/fs/erofs/zdata.c
> @@ -1841,7 +1841,7 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f,
>  	}
>  
>  	cur = map->m_la + map->m_llen - 1;
> -	while (cur >= end) {
> +	while ((cur >= end) && (cur < i_size_read(inode))) {
>  		pgoff_t index = cur >> PAGE_SHIFT;
>  		struct page *page;
>  

Reviewed-by: Yue Hu <huyue2@...lpad.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ