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] [day] [month] [year] [list]
Message-ID: <d3a24db9-72a2-a162-025a-505909cf6ef2@huawei.com>
Date:   Thu, 4 Jul 2019 15:22:13 +0800
From:   Chao Yu <yuchao0@...wei.com>
To:     Ocean Chen <oceanchen@...gle.com>, <jaegeuk@...nel.org>,
        <linux-f2fs-devel@...ts.sourceforge.net>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] f2fs: avoid out-of-range memory access

On 2019/7/3 23:33, Ocean Chen wrote:
> blk_off might over 512 due to fs corrupt and should
> be checked before being used.
> Use ENTRIES_IN_SUM to protect invalid memory access.
> 
> --
> v2:
> - fix typo
> v3:
> - check blk_off before being used
> --
> Signed-off-by: Ocean Chen <oceanchen@...gle.com>
> ---
>  fs/f2fs/segment.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 8dee063c833f..c3eae3239345 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -3401,6 +3401,9 @@ static int read_compacted_summaries(struct f2fs_sb_info *sbi)
>  		if (seg_i->alloc_type == SSR)
>  			blk_off = sbi->blocks_per_seg;
>  
> +                if (blk_off >= ENTRIES_IN_SUM)
> +                  return -EFAULT;

- scripts/checkpatch.pl will complain such format.
- miss to call f2fs_put_page(page, 1) before return.

Thanks,

> +
>  		for (j = 0; j < blk_off; j++) {
>  			struct f2fs_summary *s;
>  			s = (struct f2fs_summary *)(kaddr + offset);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ