CVE-2022-49706 Information
Description
In the Linux kernel the following vulnerability has been resolved:
zonefs: fix zonefs_iomap_begin() for reads
If a readahead is issued to a sequential zone file with an offset exactly equal to the current file size the iomap type is set to IOMAP_UNWRITTEN which will prevent an IO but the iomap length is calculated as 0. This causes a WARN_ON() in iomap_iter():
[17309.548939] WARNING: CPU: 3 PID: 2137 at fs/iomap/iter.c:34 iomap_iter+0x9cf/0xe80
[…]
[17309.650907] RIP: 0010:iomap_iter+0x9cf/0xe80
[…]
[17309.754560] Call Trace:
[17309.757078]
Furthermore this causes iomap_readahead() to loop forever as iomap_readahead_iter() always returns 0 making no progress.
Fix this by treating reads after the file size as access to holes setting the iomap type to IOMAP_HOLE the iomap addr to IOMAP_NULL_ADDR and using the length argument as is for the iomap length. To simplify the code with this change zonefs_iomap_begin() is split into the read variant zonefs_read_iomap_begin() and zonefs_read_iomap_ops and the write variant zonefs_write_iomap_begin() and zonefs_write_iomap_ops.
Reference
https://git.kernel.org/stable/c/355be6131164c5bacf2e810763835aecb6e01fcb https://git.kernel.org/stable/c/3a7f05f104347b407e865c10be2675cd833a4e48 https://git.kernel.org/stable/c/c1c1204c0d0c1dccc1310b9277fb2bd8b663d8fe https://git.kernel.org/stable/c/c2f71b9bb398e2e573bdc2574149f42b45efe410
Share on: