Skip to contentSkip to conversation

BUG: Bad page state in z_erofs_do_read_page

v6.6 Gao Xiang 2 participants 4 messages Mar 25 EROFS file system

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

#syz test

fs/erofs/zdata.c +2 -0
index c1f802ecc47b..e744717d6003 100644
@@ -1538,6 +1538,8 @@ static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl,
 	}
 	unlock_page(page);
 	put_page(page);
+	/* since pcl->compressed_bvecs[nr].page has changed above */
+	oldpage = page;
 out_allocpage:
 	page = erofs_allocpage(pagepool, gfp | __GFP_NOFAIL);
 	if (oldpage != cmpxchg(&pcl->compressed_bvecs[nr].page,
author
#1 lore raw

#syz test

fs/erofs/zdata.c +1 -0
index 496e4c7c52a4..29a73cbb5535 100644
@@ -1485,6 +1485,7 @@ static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl,
 	lock_page(page);
 	if (likely(page->mapping == mc)) {
 		WRITE_ONCE(pcl->compressed_bvecs[nr].page, page);
+		oldpage = page;
 
 		/*
 		 * The cached folio is still in managed cache but without
syzbot Tested-by
#2 lore raw
syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Tested on:

commit:         4fc00fe3 Linux 6.6.129
git tree:       linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=135ff6da580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=cf30d9e358c58220
dashboard link: https://syzkaller.appspot.com/bug?extid=b6353e35ae2bab997538
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1029ecba580000

Note: testing is done by a robot and is best-effort only.

syzbot
#3 lore raw
In reply to Gao Xiang
syzbot tried to test the proposed patch but the build/boot failed:

Hello,

syzbot tried to test the proposed patch but the build/boot failed:

failed to apply patch:
checking file fs/erofs/zdata.c
Hunk #1 FAILED at 1538.
1 out of 1 hunk FAILED

Tested on:

commit:         4fc00fe3 Linux 6.6.129
git tree:       linux-6.6.y
kernel config:  https://syzkaller.appspot.com/x/.config?x=691a6769a86ac817
dashboard link: https://syzkaller.appspot.com/bug?extid=b6353e35ae2bab997538

compiler:
patch: https://syzkaller.appspot.com/x/patch.diff?x=105721d6580000