* [PATCH v2 6.1] erofs: Fix the slab-out-of-bounds in drop_buffers()
@ 2026-03-23 13:59 Denis Arefev
2026-03-24 2:24 ` Gao Xiang
0 siblings, 1 reply; 2+ messages in thread
From: Denis Arefev @ 2026-03-23 13:59 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman
Cc: Gao Xiang, Chao Yu, Jeffle Xu, linux-erofs, linux-kernel,
lvc-project, syzbot+5b886a2e03529dbcef81
commit ce529cc25b184e93397b94a8a322128fc0095cbb upstream.
This was accidentally fixed in commit ce529cc25b18, but it's not possible
to accept all the changes, due to the lack of large folios support for
Linux 6.1 kernels, so this is only the actual bug fix that's needed.
[Background]
Syzbot reported that a KASAN slab-out-of-bounds bug was discovered in
the drop_buffers() function [1].
The root cause is that erofs_raw_access_aops does not define .release_folio
and .invalidate_folio. When using iomap-based operations, folio->private
may contain iomap-specific data rather than buffer_heads. Without special
handlers, the kernel may fall back to generic functions (such as
drop_buffers), which incorrectly treat folio->private as a list of
buffer_head structures, leading to incorrect memory interpretation and
out-of-bounds access.
Fix this by explicitly setting .release_folio and .invalidate_folio to the
values of iomap_release_folio and iomap_invalidate_folio, respectively.
[1] https://syzkaller.appspot.com/x/report.txt?x=12e5a142580000
Fixes: 7479c505b4ab ("fs: Convert iomap_readpage to iomap_read_folio")
Reported-by: syzbot+5b886a2e03529dbcef81@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?id=c6aeabd0c4ad2466f63a274faf2a123103f8fbf7
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
fs/erofs/data.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index 7b648bec61fd..302e824827fc 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -406,6 +406,8 @@ const struct address_space_operations erofs_raw_access_aops = {
.readahead = erofs_readahead,
.bmap = erofs_bmap,
.direct_IO = noop_direct_IO,
+ .release_folio = iomap_release_folio,
+ .invalidate_folio = iomap_invalidate_folio,
};
#ifdef CONFIG_FS_DAX
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 6.1] erofs: Fix the slab-out-of-bounds in drop_buffers()
2026-03-23 13:59 [PATCH v2 6.1] erofs: Fix the slab-out-of-bounds in drop_buffers() Denis Arefev
@ 2026-03-24 2:24 ` Gao Xiang
0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2026-03-24 2:24 UTC (permalink / raw)
To: Denis Arefev, stable, Greg Kroah-Hartman
Cc: Gao Xiang, Chao Yu, Jeffle Xu, linux-erofs, linux-kernel,
lvc-project, syzbot+5b886a2e03529dbcef81
On 2026/3/23 21:59, Denis Arefev wrote:
> commit ce529cc25b184e93397b94a8a322128fc0095cbb upstream.
>
> This was accidentally fixed in commit ce529cc25b18, but it's not possible
> to accept all the changes, due to the lack of large folios support for
> Linux 6.1 kernels, so this is only the actual bug fix that's needed.
>
> [Background]
>
> Syzbot reported that a KASAN slab-out-of-bounds bug was discovered in
> the drop_buffers() function [1].
>
> The root cause is that erofs_raw_access_aops does not define .release_folio
> and .invalidate_folio. When using iomap-based operations, folio->private
> may contain iomap-specific data rather than buffer_heads. Without special
> handlers, the kernel may fall back to generic functions (such as
> drop_buffers), which incorrectly treat folio->private as a list of
> buffer_head structures, leading to incorrect memory interpretation and
> out-of-bounds access.
>
> Fix this by explicitly setting .release_folio and .invalidate_folio to the
> values of iomap_release_folio and iomap_invalidate_folio, respectively.
>
> [1] https://syzkaller.appspot.com/x/report.txt?x=12e5a142580000
>
> Fixes: 7479c505b4ab ("fs: Convert iomap_readpage to iomap_read_folio")
> Reported-by: syzbot+5b886a2e03529dbcef81@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?id=c6aeabd0c4ad2466f63a274faf2a123103f8fbf7
> Signed-off-by: Denis Arefev <arefev@swemel.ru>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-24 2:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23 13:59 [PATCH v2 6.1] erofs: Fix the slab-out-of-bounds in drop_buffers() Denis Arefev
2026-03-24 2:24 ` Gao Xiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox