In the Linux kernel, the following vulnerability has been resolved:
f2fs: compress: fix reserve_cblocks counting error when out of space
When a file only needs one direct_node, performing the following operations will cause the file to be unrepairable:
unisoc # ./f2fs_io compress test.apk unisoc #df -h | grep dm-48 /dev/block/dm-48 112G 112G 1.2M 100% /data
unisoc # ./f2fsio releasecblocks test.apk 924 unisoc # df -h | grep dm-48 /dev/block/dm-48 112G 112G 4.8M 100% /data
unisoc # dd if=/dev/random of=file4 bs=1M count=3 3145728 bytes (3.0 M) copied, 0.025 s, 120 M/s unisoc # df -h | grep dm-48 /dev/block/dm-48 112G 112G 1.8M 100% /data
unisoc # ./f2fsio reservecblocks test.apk F2FSIOCRESERVECOMPRESSBLOCKS failed: No space left on device
adb reboot unisoc # df -h | grep dm-48 /dev/block/dm-48 112G 112G 11M 100% /data unisoc # ./f2fsio reservecblocks test.apk 0
This is because the file has only one directnode. After returning to -ENOSPC, reservedblocks += ret will not be executed. As a result, the reserved_blocks at this time is still 0, which is not the real number of reserved blocks. Therefore, fsck cannot be set to repair the file.
After this patch, the fsck flag will be set to fix this problem.
unisoc # df -h | grep dm-48 /dev/block/dm-48 112G 112G 1.8M 100% /data unisoc # ./f2fsio reservecblocks test.apk F2FSIOCRESERVECOMPRESSBLOCKS failed: No space left on device
adb reboot then fsck will be executed unisoc # df -h | grep dm-48 /dev/block/dm-48 112G 112G 11M 100% /data unisoc # ./f2fsio reservecblocks test.apk 924
[
{
"digest": {
"function_hash": "260842253938825473415479761083508003013",
"length": 1244.0
},
"id": "CVE-2024-35844-05811386",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f0bf89e84c3afb79d7a3a9e4bc853ad6a3245c0a",
"target": {
"file": "fs/f2fs/file.c",
"function": "reserve_compress_blocks"
},
"deprecated": false
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"43402324318471901103715974925618007959",
"41143826489364678219388866987821554941",
"44631515794225703918556489374247081373",
"95571068779521835060136462996469465711",
"322552827877158111735436205820166304813",
"227150205865425991499672430345986409649",
"56752142988514909348793642067671886526",
"225862261199164077694933661617448430121",
"258603459209428410440159675110558276969",
"294734927796634668594845961184918956161",
"223950696251494344189206575381463548136",
"15670472663541649171968931733138910113",
"60273966783796062585269877154224935146",
"71978205513422372736897398131800691272",
"50242453723050772244716543689534278887",
"181770882194627365579554399918722395867",
"109373760772369518607125539772871965297",
"152167664718360382374647527575655619164",
"20215486304767780493106081329971559864",
"28615863730867376445400152958260433919",
"17567958100143953325513715772214388561",
"65002174720457124305693572125778308441",
"264924472110663130294465470018695625255",
"205284609661014991144828681068622028431",
"97922627548042490604724053744798298637",
"49394968608207668665153073555899873638",
"53614306360454801566951058915760363746",
"200286379154785772867102771142483964819",
"29400741783015264027031505562793529661",
"122035955513867519188927892162340237884",
"295990648530444797994253143461340512054"
]
},
"id": "CVE-2024-35844-18b362ae",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@889846dfc8ee2cf31148a44bfd2faeb2faadc685",
"target": {
"file": "fs/f2fs/file.c"
},
"deprecated": false
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"43402324318471901103715974925618007959",
"41143826489364678219388866987821554941",
"44631515794225703918556489374247081373",
"95571068779521835060136462996469465711",
"322552827877158111735436205820166304813",
"227150205865425991499672430345986409649",
"56752142988514909348793642067671886526",
"225862261199164077694933661617448430121",
"258603459209428410440159675110558276969",
"294734927796634668594845961184918956161",
"223950696251494344189206575381463548136",
"15670472663541649171968931733138910113",
"60273966783796062585269877154224935146",
"71978205513422372736897398131800691272",
"50242453723050772244716543689534278887",
"181770882194627365579554399918722395867",
"109373760772369518607125539772871965297",
"152167664718360382374647527575655619164",
"20215486304767780493106081329971559864",
"28615863730867376445400152958260433919",
"17567958100143953325513715772214388561",
"65002174720457124305693572125778308441",
"264924472110663130294465470018695625255",
"205284609661014991144828681068622028431",
"97922627548042490604724053744798298637",
"237168898795815660028866367248740044559",
"121287781558263856703318003093987504584",
"200286379154785772867102771142483964819",
"29400741783015264027031505562793529661",
"122035955513867519188927892162340237884",
"295990648530444797994253143461340512054"
]
},
"id": "CVE-2024-35844-21253c9b",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@569c198c9e2093fd29cc071856a4e548fda506bc",
"target": {
"file": "fs/f2fs/file.c"
},
"deprecated": false
},
{
"digest": {
"function_hash": "118420876649830885516759011136068793775",
"length": 1929.0
},
"id": "CVE-2024-35844-304863b7",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2f6d721e14b69d6e1251f69fa238b48e8374e25f",
"target": {
"file": "fs/f2fs/file.c",
"function": "f2fs_reserve_compress_blocks"
},
"deprecated": false
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"43402324318471901103715974925618007959",
"41143826489364678219388866987821554941",
"44631515794225703918556489374247081373",
"95571068779521835060136462996469465711",
"322552827877158111735436205820166304813",
"227150205865425991499672430345986409649",
"56752142988514909348793642067671886526",
"225862261199164077694933661617448430121",
"258603459209428410440159675110558276969",
"294734927796634668594845961184918956161",
"223950696251494344189206575381463548136",
"15670472663541649171968931733138910113",
"60273966783796062585269877154224935146",
"71978205513422372736897398131800691272",
"50242453723050772244716543689534278887",
"181770882194627365579554399918722395867",
"109373760772369518607125539772871965297",
"152167664718360382374647527575655619164",
"20215486304767780493106081329971559864",
"28615863730867376445400152958260433919",
"17567958100143953325513715772214388561",
"65002174720457124305693572125778308441",
"264924472110663130294465470018695625255",
"205284609661014991144828681068622028431",
"97922627548042490604724053744798298637",
"237168898795815660028866367248740044559",
"121287781558263856703318003093987504584",
"200286379154785772867102771142483964819",
"29400741783015264027031505562793529661",
"122035955513867519188927892162340237884",
"295990648530444797994253143461340512054"
]
},
"id": "CVE-2024-35844-3cbdd1da",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2f6d721e14b69d6e1251f69fa238b48e8374e25f",
"target": {
"file": "fs/f2fs/file.c"
},
"deprecated": false
},
{
"digest": {
"function_hash": "209212093715320746636477325859049297450",
"length": 1946.0
},
"id": "CVE-2024-35844-40a5f71c",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@889846dfc8ee2cf31148a44bfd2faeb2faadc685",
"target": {
"file": "fs/f2fs/file.c",
"function": "f2fs_reserve_compress_blocks"
},
"deprecated": false
},
{
"digest": {
"function_hash": "260842253938825473415479761083508003013",
"length": 1244.0
},
"id": "CVE-2024-35844-468c1885",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fc0aed88afbf6f606205129a7466eebdf528e3f3",
"target": {
"file": "fs/f2fs/file.c",
"function": "reserve_compress_blocks"
},
"deprecated": false
},
{
"digest": {
"function_hash": "200525471027018793361132534481201682895",
"length": 1969.0
},
"id": "CVE-2024-35844-620d12d8",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fa3ac8b1a227d9b470b87972494293348b5839ee",
"target": {
"file": "fs/f2fs/file.c",
"function": "f2fs_reserve_compress_blocks"
},
"deprecated": false
},
{
"digest": {
"function_hash": "118420876649830885516759011136068793775",
"length": 1929.0
},
"id": "CVE-2024-35844-793f589e",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@569c198c9e2093fd29cc071856a4e548fda506bc",
"target": {
"file": "fs/f2fs/file.c",
"function": "f2fs_reserve_compress_blocks"
},
"deprecated": false
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"43402324318471901103715974925618007959",
"41143826489364678219388866987821554941",
"44631515794225703918556489374247081373",
"95571068779521835060136462996469465711",
"322552827877158111735436205820166304813",
"227150205865425991499672430345986409649",
"56752142988514909348793642067671886526",
"225862261199164077694933661617448430121",
"258603459209428410440159675110558276969",
"294734927796634668594845961184918956161",
"223950696251494344189206575381463548136",
"15670472663541649171968931733138910113",
"60273966783796062585269877154224935146",
"71978205513422372736897398131800691272",
"50242453723050772244716543689534278887",
"181770882194627365579554399918722395867",
"109373760772369518607125539772871965297",
"152167664718360382374647527575655619164",
"20215486304767780493106081329971559864",
"28615863730867376445400152958260433919",
"17567958100143953325513715772214388561",
"65002174720457124305693572125778308441",
"264924472110663130294465470018695625255",
"205284609661014991144828681068622028431",
"97922627548042490604724053744798298637",
"237168898795815660028866367248740044559",
"121287781558263856703318003093987504584",
"200286379154785772867102771142483964819",
"29400741783015264027031505562793529661",
"122035955513867519188927892162340237884",
"295990648530444797994253143461340512054"
]
},
"id": "CVE-2024-35844-8411d302",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fc0aed88afbf6f606205129a7466eebdf528e3f3",
"target": {
"file": "fs/f2fs/file.c"
},
"deprecated": false
},
{
"digest": {
"function_hash": "260842253938825473415479761083508003013",
"length": 1244.0
},
"id": "CVE-2024-35844-8d18e997",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@889846dfc8ee2cf31148a44bfd2faeb2faadc685",
"target": {
"file": "fs/f2fs/file.c",
"function": "reserve_compress_blocks"
},
"deprecated": false
},
{
"digest": {
"function_hash": "29350823927521996265421826961744086074",
"length": 1095.0
},
"id": "CVE-2024-35844-a6291230",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fa3ac8b1a227d9b470b87972494293348b5839ee",
"target": {
"file": "fs/f2fs/file.c",
"function": "reserve_compress_blocks"
},
"deprecated": false
},
{
"digest": {
"function_hash": "118420876649830885516759011136068793775",
"length": 1929.0
},
"id": "CVE-2024-35844-b2417665",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f0bf89e84c3afb79d7a3a9e4bc853ad6a3245c0a",
"target": {
"file": "fs/f2fs/file.c",
"function": "f2fs_reserve_compress_blocks"
},
"deprecated": false
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"43402324318471901103715974925618007959",
"41143826489364678219388866987821554941",
"44631515794225703918556489374247081373",
"95571068779521835060136462996469465711",
"322552827877158111735436205820166304813",
"227150205865425991499672430345986409649",
"56752142988514909348793642067671886526",
"129638745957131825079298331209390855678",
"141403345507333569007183199017311407556",
"294734927796634668594845961184918956161",
"223950696251494344189206575381463548136",
"15670472663541649171968931733138910113",
"60273966783796062585269877154224935146",
"71978205513422372736897398131800691272",
"50242453723050772244716543689534278887",
"181770882194627365579554399918722395867",
"109373760772369518607125539772871965297",
"152167664718360382374647527575655619164",
"20215486304767780493106081329971559864",
"28615863730867376445400152958260433919",
"17567958100143953325513715772214388561",
"65002174720457124305693572125778308441",
"61672445094701032482870343943929038601",
"15311013440600640729807250993033877433",
"103961037662173786998268397872422850975",
"110451702548527843089581060439044314235",
"53614306360454801566951058915760363746",
"290142208890602786547340255813239538614",
"319744334283787379842382911175057286785",
"122035955513867519188927892162340237884",
"295990648530444797994253143461340512054"
]
},
"id": "CVE-2024-35844-c85500b5",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fa3ac8b1a227d9b470b87972494293348b5839ee",
"target": {
"file": "fs/f2fs/file.c"
},
"deprecated": false
},
{
"digest": {
"function_hash": "118420876649830885516759011136068793775",
"length": 1929.0
},
"id": "CVE-2024-35844-d0145885",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fc0aed88afbf6f606205129a7466eebdf528e3f3",
"target": {
"file": "fs/f2fs/file.c",
"function": "f2fs_reserve_compress_blocks"
},
"deprecated": false
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"43402324318471901103715974925618007959",
"41143826489364678219388866987821554941",
"44631515794225703918556489374247081373",
"95571068779521835060136462996469465711",
"322552827877158111735436205820166304813",
"227150205865425991499672430345986409649",
"56752142988514909348793642067671886526",
"225862261199164077694933661617448430121",
"258603459209428410440159675110558276969",
"294734927796634668594845961184918956161",
"223950696251494344189206575381463548136",
"15670472663541649171968931733138910113",
"60273966783796062585269877154224935146",
"71978205513422372736897398131800691272",
"50242453723050772244716543689534278887",
"181770882194627365579554399918722395867",
"109373760772369518607125539772871965297",
"152167664718360382374647527575655619164",
"20215486304767780493106081329971559864",
"28615863730867376445400152958260433919",
"17567958100143953325513715772214388561",
"65002174720457124305693572125778308441",
"264924472110663130294465470018695625255",
"205284609661014991144828681068622028431",
"97922627548042490604724053744798298637",
"237168898795815660028866367248740044559",
"121287781558263856703318003093987504584",
"200286379154785772867102771142483964819",
"29400741783015264027031505562793529661",
"122035955513867519188927892162340237884",
"295990648530444797994253143461340512054"
]
},
"id": "CVE-2024-35844-d51e6a95",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f0bf89e84c3afb79d7a3a9e4bc853ad6a3245c0a",
"target": {
"file": "fs/f2fs/file.c"
},
"deprecated": false
},
{
"digest": {
"function_hash": "260842253938825473415479761083508003013",
"length": 1244.0
},
"id": "CVE-2024-35844-d8730b86",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2f6d721e14b69d6e1251f69fa238b48e8374e25f",
"target": {
"file": "fs/f2fs/file.c",
"function": "reserve_compress_blocks"
},
"deprecated": false
},
{
"digest": {
"function_hash": "260842253938825473415479761083508003013",
"length": 1244.0
},
"id": "CVE-2024-35844-dec6bf4b",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@569c198c9e2093fd29cc071856a4e548fda506bc",
"target": {
"file": "fs/f2fs/file.c",
"function": "reserve_compress_blocks"
},
"deprecated": false
}
]