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]
Date:   Fri, 5 May 2023 18:50:56 +0200
From:   Jan Kara <jack@...e.cz>
To:     Baokun Li <libaokun1@...wei.com>
Cc:     linux-ext4@...r.kernel.org, tytso@....edu,
        adilger.kernel@...ger.ca, jack@...e.cz, ritesh.list@...il.com,
        linux-kernel@...r.kernel.org, yi.zhang@...wei.com,
        yangerkun@...wei.com, yukuai3@...wei.com,
        syzbot+08106c4b7d60702dbc14@...kaller.appspotmail.com
Subject: Re: [PATCH] ext4: check iomap type only if ext4_iomap_begin() does
 not fail

On Fri 05-05-23 21:24:29, Baokun Li wrote:
> When ext4_iomap_overwrite_begin() calls ext4_iomap_begin() map blocks may
> fail for some reason (e.g. memory allocation failure, bare disk write), and
> later because "iomap->type ! = IOMAP_MAPPED" triggers WARN_ON(). When ext4
> iomap_begin() returns an error, it is normal that the type of iomap->type
> may not match the expectation. Therefore, we only determine if iomap->type
> is as expected when ext4_iomap_begin() is executed successfully.
> 
> Reported-by: syzbot+08106c4b7d60702dbc14@...kaller.appspotmail.com
> Link: https://lore.kernel.org/all/00000000000015760b05f9b4eee9@google.com
> Signed-off-by: Baokun Li <libaokun1@...wei.com>

Makes sense. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 0d5ba922e411..19c884abe52b 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3375,7 +3375,7 @@ static int ext4_iomap_overwrite_begin(struct inode *inode, loff_t offset,
>  	 */
>  	flags &= ~IOMAP_WRITE;
>  	ret = ext4_iomap_begin(inode, offset, length, flags, iomap, srcmap);
> -	WARN_ON_ONCE(iomap->type != IOMAP_MAPPED);
> +	WARN_ON_ONCE(!ret && iomap->type != IOMAP_MAPPED);
>  	return ret;
>  }
>  
> -- 
> 2.31.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ