In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix potential deadloop in preparecompressoverwrite()
Jan Prusakowski reported a kernel hang issue as below:
When running xfstests on linux-next kernel (6.14.0-rc3, 6.12) I encountered a problem in generic/475 test where fsstress process gets blocked in _f2fswritedatapages() and the test hangs. The options I used are:
MKFSOPTIONS -- -O compression -O extraattr -O projectquota -O quota /dev/vdc MOUNTOPTIONS -- -o acl,userxattr -o discard,compressextension=* /dev/vdc /vdc
INFO: task kworker/u8:0:11 blocked for more than 122 seconds. Not tainted 6.14.0-rc3-xfstests-lockdep #1 "echo 0 > /proc/sys/kernel/hungtasktimeoutsecs" disables this message. task:kworker/u8:0 state:D stack:0 pid:11 tgid:11 ppid:2 taskflags:0x4208160 flags:0x00004000 Workqueue: writeback wbworkfn (flush-253:0) Call Trace: <TASK> _schedule+0x309/0x8e0 schedule+0x3a/0x100 schedulepreemptdisabled+0x15/0x30 _mutexlock+0x59a/0xdb0 _f2fswritedatapages+0x3ac/0x400 dowritepages+0xe8/0x290 _writebacksingleinode+0x5c/0x360 writebacksbinodes+0x22f/0x570 wbwriteback+0xb0/0x410 wbdowriteback+0x47/0x2f0 wbworkfn+0x5a/0x1c0 processonework+0x223/0x5b0 workerthread+0x1d5/0x3c0 kthread+0xfd/0x230 retfromfork+0x31/0x50 retfromforkasm+0x1a/0x30 </TASK>
The root cause is: once generic/475 starts toload error table to dm device, f2fspreparecompress_overwrite() will loop reading compressed cluster pages due to IO error, meanwhile it has held .writepages lock, it can block all other writeback tasks.
Let's fix this issue w/ below changes: - add f2fshandlepageeio() in preparecompressoverwrite() to detect IO error. - detect cperror earler in f2fsreadmulti_pages().
[
{
"target": {
"function": "f2fs_read_multi_pages",
"file": "fs/f2fs/data.c"
},
"id": "CVE-2025-22127-011e42b9",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3147ee567dd9004a49826ddeaf0a4b12865d4409",
"deprecated": false,
"digest": {
"function_hash": "97317583362511457047812772367070945842",
"length": 3312.0
},
"signature_type": "Function",
"signature_version": "v1"
},
{
"target": {
"function": "prepare_compress_overwrite",
"file": "fs/f2fs/compress.c"
},
"id": "CVE-2025-22127-1bb12a63",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7215cf8ef54bdc9082dffac4662416d54961e258",
"deprecated": false,
"digest": {
"function_hash": "210072821659598619832863666654460878250",
"length": 1655.0
},
"signature_type": "Function",
"signature_version": "v1"
},
{
"target": {
"file": "fs/f2fs/compress.c"
},
"id": "CVE-2025-22127-28ea36eb",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7215cf8ef54bdc9082dffac4662416d54961e258",
"deprecated": false,
"digest": {
"threshold": 0.9,
"line_hashes": [
"65536260179218319198532367600038162918",
"174481961564395526918185556559610423125",
"256005010742619738394727883077922875654",
"205330410729292686021633243947271195274"
]
},
"signature_type": "Line",
"signature_version": "v1"
},
{
"target": {
"function": "prepare_compress_overwrite",
"file": "fs/f2fs/compress.c"
},
"id": "CVE-2025-22127-4ce8c567",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3147ee567dd9004a49826ddeaf0a4b12865d4409",
"deprecated": false,
"digest": {
"function_hash": "210072821659598619832863666654460878250",
"length": 1655.0
},
"signature_type": "Function",
"signature_version": "v1"
},
{
"target": {
"file": "fs/f2fs/compress.c"
},
"id": "CVE-2025-22127-5130abb7",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3147ee567dd9004a49826ddeaf0a4b12865d4409",
"deprecated": false,
"digest": {
"threshold": 0.9,
"line_hashes": [
"65536260179218319198532367600038162918",
"174481961564395526918185556559610423125",
"256005010742619738394727883077922875654",
"205330410729292686021633243947271195274"
]
},
"signature_type": "Line",
"signature_version": "v1"
},
{
"target": {
"function": "f2fs_read_multi_pages",
"file": "fs/f2fs/data.c"
},
"id": "CVE-2025-22127-7637fd13",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7215cf8ef54bdc9082dffac4662416d54961e258",
"deprecated": false,
"digest": {
"function_hash": "97317583362511457047812772367070945842",
"length": 3312.0
},
"signature_type": "Function",
"signature_version": "v1"
},
{
"target": {
"file": "fs/f2fs/data.c"
},
"id": "CVE-2025-22127-c55dfeaf",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3147ee567dd9004a49826ddeaf0a4b12865d4409",
"deprecated": false,
"digest": {
"threshold": 0.9,
"line_hashes": [
"312789573912672734746319990194076237902",
"142586329831572547450335241020454182005",
"56602819442846905587656215093767363133",
"300600884981685355135650859948390325158",
"28128705644417286725946971518833909763",
"151718627205445470644187419235630765036",
"135195752965066442856722273949641577182",
"126516929137618747025647075404069922343",
"186284333954980030001196712816611607050",
"61187558835373792125875513380602490212"
]
},
"signature_type": "Line",
"signature_version": "v1"
},
{
"target": {
"file": "fs/f2fs/data.c"
},
"id": "CVE-2025-22127-df18fe3c",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7215cf8ef54bdc9082dffac4662416d54961e258",
"deprecated": false,
"digest": {
"threshold": 0.9,
"line_hashes": [
"312789573912672734746319990194076237902",
"142586329831572547450335241020454182005",
"56602819442846905587656215093767363133",
"300600884981685355135650859948390325158",
"28128705644417286725946971518833909763",
"151718627205445470644187419235630765036",
"135195752965066442856722273949641577182",
"126516929137618747025647075404069922343",
"186284333954980030001196712816611607050",
"61187558835373792125875513380602490212"
]
},
"signature_type": "Line",
"signature_version": "v1"
}
]