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: <1b9d6a6d-4e19-f455-bf9a-659b85a3206f@kernel.org>
Date:   Tue, 25 Oct 2022 10:53:40 +0800
From:   Chao Yu <chao@...nel.org>
To:     Pavel Machek <pavel@...x.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Wenqing Liu <wenqingliu0120@...il.com>,
        Jaegeuk Kim <jaegeuk@...nel.org>
Subject: Re: [PATCH 5.10 052/390] f2fs: fix to do sanity check on summary info

On 2022/10/25 1:30, Pavel Machek wrote:
> Hi!
> 
>> From: Chao Yu <chao@...nel.org>
>>
>> commit c6ad7fd16657ebd34a87a97d9588195aae87597d upstream.
>>
>> As Wenqing Liu reported in bugzilla:
>>
>> https://bugzilla.kernel.org/show_bug.cgi?id=216456
>>
>> BUG: KASAN: use-after-free in recover_data+0x63ae/0x6ae0 [f2fs]
>> Read of size 4 at addr ffff8881464dcd80 by task mount/1013
> 
> I believe this is missing put_page on the error path:
> 
>> +++ b/fs/f2fs/gc.c
>> @@ -1003,6 +1003,14 @@ static bool is_alive(struct f2fs_sb_info
>>   		return false;
>>   	}
>>   
>> +	max_addrs = IS_INODE(node_page) ? DEF_ADDRS_PER_INODE :
>> +						DEF_ADDRS_PER_BLOCK;
>> +	if (ofs_in_node >= max_addrs) {
>> +		f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%u, nid:%u, max:%u",
>> +			ofs_in_node, dni->ino, dni->nid, max_addrs);
>> +		return false;
>> +	}
>> +
>>   	*nofs = ofs_of_node(node_page);
>>   	source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node);
>>   	f2fs_put_page(node_page, 1);
> 
> So something like this is needed. (Feel free to test/adapt/apply).
> 
> Signed-off-by: Pavel Machek <pavel@...x.de>
> 
> Best regards,
> 								Pavel
> 
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 4546e01b2ee0..dab794225cce 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -1110,6 +1110,7 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
>   	if (ofs_in_node >= max_addrs) {
>   		f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%u, nid:%u, max:%u",
>   			ofs_in_node, dni->ino, dni->nid, max_addrs);
> +		f2fs_put_page(node_page, 1);
>   		return false;
>   	}

My bad, thanks for fixing this.

Reviewed-by: Chao Yu <chao@...nel.org>

Thanks,

>   
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ