CVE-2021-47585 (GCVE-0-2021-47585)
Vulnerability from cvelistv5 – Published: 2024-06-19 14:53 – Updated: 2026-05-11 13:57
VLAI
EPSS
VEX
Title
btrfs: fix memory leak in __add_inode_ref()
Summary
In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix memory leak in __add_inode_ref()
Line 1169 (#3) allocates a memory chunk for victim_name by kmalloc(),
but when the function returns in line 1184 (#4) victim_name allocated
by line 1169 (#3) is not freed, which will lead to a memory leak.
There is a similar snippet of code in this function as allocating a memory
chunk for victim_name in line 1104 (#1) as well as releasing the memory
in line 1116 (#2).
We should kfree() victim_name when the return value of backref_in_log()
is less than zero and before the function returns in line 1184 (#4).
1057 static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
1058 struct btrfs_root *root,
1059 struct btrfs_path *path,
1060 struct btrfs_root *log_root,
1061 struct btrfs_inode *dir,
1062 struct btrfs_inode *inode,
1063 u64 inode_objectid, u64 parent_objectid,
1064 u64 ref_index, char *name, int namelen,
1065 int *search_done)
1066 {
1104 victim_name = kmalloc(victim_name_len, GFP_NOFS);
// #1: kmalloc (victim_name-1)
1105 if (!victim_name)
1106 return -ENOMEM;
1112 ret = backref_in_log(log_root, &search_key,
1113 parent_objectid, victim_name,
1114 victim_name_len);
1115 if (ret < 0) {
1116 kfree(victim_name); // #2: kfree (victim_name-1)
1117 return ret;
1118 } else if (!ret) {
1169 victim_name = kmalloc(victim_name_len, GFP_NOFS);
// #3: kmalloc (victim_name-2)
1170 if (!victim_name)
1171 return -ENOMEM;
1180 ret = backref_in_log(log_root, &search_key,
1181 parent_objectid, victim_name,
1182 victim_name_len);
1183 if (ret < 0) {
1184 return ret; // #4: missing kfree (victim_name-2)
1185 } else if (!ret) {
1241 return 0;
1242 }
Severity
No CVSS data available.
SSVC
Exploitation: none
Automatable: no
Technical Impact: partial
CISA Coordinator · CISA-ADP (v2.0.3)
Decision recorded 2024-06-24 18:08 UTC
Assigner
References
Impacted products
2 products
| Vendor | Product | Version | CPE status | |
|---|---|---|---|---|
| Linux | Linux |
Affected:
d3316c8233bb05e0dd855d30aac347bb8ad76ee4 , < 005d9292b5b2e71a009f911bd85d755009b37242
(git)
Affected: d3316c8233bb05e0dd855d30aac347bb8ad76ee4 , < 493ff661d434d6bdf02e3a21adae04d7a0b4265d (git) Affected: d3316c8233bb05e0dd855d30aac347bb8ad76ee4 , < f35838a6930296fc1988764cfa54cb3f705c0665 (git) |
guessed | |
| Linux | Linux |
Affected:
5.5
Unaffected: 0 , < 5.5 (semver) Unaffected: 5.10.88 , ≤ 5.10.* (semver) Unaffected: 5.15.11 , ≤ 5.15.* (semver) Unaffected: 5.16 , ≤ * (original_commit_for_fix) |
guessed |
{
"containers": {
"adp": [
{
"metrics": [
{
"other": {
"content": {
"id": "CVE-2021-47585",
"options": [
{
"Exploitation": "none"
},
{
"Automatable": "no"
},
{
"Technical Impact": "partial"
}
],
"role": "CISA Coordinator",
"timestamp": "2024-06-24T18:08:01.516987Z",
"version": "2.0.3"
},
"type": "ssvc"
}
}
],
"providerMetadata": {
"dateUpdated": "2024-06-24T18:08:15.557Z",
"orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"shortName": "CISA-ADP"
},
"title": "CISA ADP Vulnrichment"
},
{
"providerMetadata": {
"dateUpdated": "2024-08-04T05:39:59.778Z",
"orgId": "af854a3a-2127-422b-91ae-364da2661108",
"shortName": "CVE"
},
"references": [
{
"tags": [
"x_transferred"
],
"url": "https://git.kernel.org/stable/c/005d9292b5b2e71a009f911bd85d755009b37242"
},
{
"tags": [
"x_transferred"
],
"url": "https://git.kernel.org/stable/c/493ff661d434d6bdf02e3a21adae04d7a0b4265d"
},
{
"tags": [
"x_transferred"
],
"url": "https://git.kernel.org/stable/c/f35838a6930296fc1988764cfa54cb3f705c0665"
}
],
"title": "CVE Program Container"
}
],
"cna": {
"affected": [
{
"defaultStatus": "unaffected",
"product": "Linux",
"programFiles": [
"fs/btrfs/tree-log.c"
],
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"versions": [
{
"lessThan": "005d9292b5b2e71a009f911bd85d755009b37242",
"status": "affected",
"version": "d3316c8233bb05e0dd855d30aac347bb8ad76ee4",
"versionType": "git"
},
{
"lessThan": "493ff661d434d6bdf02e3a21adae04d7a0b4265d",
"status": "affected",
"version": "d3316c8233bb05e0dd855d30aac347bb8ad76ee4",
"versionType": "git"
},
{
"lessThan": "f35838a6930296fc1988764cfa54cb3f705c0665",
"status": "affected",
"version": "d3316c8233bb05e0dd855d30aac347bb8ad76ee4",
"versionType": "git"
}
]
},
{
"defaultStatus": "affected",
"product": "Linux",
"programFiles": [
"fs/btrfs/tree-log.c"
],
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"versions": [
{
"status": "affected",
"version": "5.5"
},
{
"lessThan": "5.5",
"status": "unaffected",
"version": "0",
"versionType": "semver"
},
{
"lessThanOrEqual": "5.10.*",
"status": "unaffected",
"version": "5.10.88",
"versionType": "semver"
},
{
"lessThanOrEqual": "5.15.*",
"status": "unaffected",
"version": "5.15.11",
"versionType": "semver"
},
{
"lessThanOrEqual": "*",
"status": "unaffected",
"version": "5.16",
"versionType": "original_commit_for_fix"
}
]
}
],
"cpeApplicability": [
{
"nodes": [
{
"cpeMatch": [
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"versionEndExcluding": "5.10.88",
"versionStartIncluding": "5.5",
"vulnerable": true
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"versionEndExcluding": "5.15.11",
"versionStartIncluding": "5.5",
"vulnerable": true
},
{
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"versionEndExcluding": "5.16",
"versionStartIncluding": "5.5",
"vulnerable": true
}
],
"negate": false,
"operator": "OR"
}
]
}
],
"descriptions": [
{
"lang": "en",
"value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: fix memory leak in __add_inode_ref()\n\nLine 1169 (#3) allocates a memory chunk for victim_name by kmalloc(),\nbut when the function returns in line 1184 (#4) victim_name allocated\nby line 1169 (#3) is not freed, which will lead to a memory leak.\nThere is a similar snippet of code in this function as allocating a memory\nchunk for victim_name in line 1104 (#1) as well as releasing the memory\nin line 1116 (#2).\n\nWe should kfree() victim_name when the return value of backref_in_log()\nis less than zero and before the function returns in line 1184 (#4).\n\n1057 static inline int __add_inode_ref(struct btrfs_trans_handle *trans,\n1058 \t\t\t\t struct btrfs_root *root,\n1059 \t\t\t\t struct btrfs_path *path,\n1060 \t\t\t\t struct btrfs_root *log_root,\n1061 \t\t\t\t struct btrfs_inode *dir,\n1062 \t\t\t\t struct btrfs_inode *inode,\n1063 \t\t\t\t u64 inode_objectid, u64 parent_objectid,\n1064 \t\t\t\t u64 ref_index, char *name, int namelen,\n1065 \t\t\t\t int *search_done)\n1066 {\n\n1104 \tvictim_name = kmalloc(victim_name_len, GFP_NOFS);\n\t// #1: kmalloc (victim_name-1)\n1105 \tif (!victim_name)\n1106 \t\treturn -ENOMEM;\n\n1112\tret = backref_in_log(log_root, \u0026search_key,\n1113\t\t\tparent_objectid, victim_name,\n1114\t\t\tvictim_name_len);\n1115\tif (ret \u003c 0) {\n1116\t\tkfree(victim_name); // #2: kfree (victim_name-1)\n1117\t\treturn ret;\n1118\t} else if (!ret) {\n\n1169 \tvictim_name = kmalloc(victim_name_len, GFP_NOFS);\n\t// #3: kmalloc (victim_name-2)\n1170 \tif (!victim_name)\n1171 \t\treturn -ENOMEM;\n\n1180 \tret = backref_in_log(log_root, \u0026search_key,\n1181 \t\t\tparent_objectid, victim_name,\n1182 \t\t\tvictim_name_len);\n1183 \tif (ret \u003c 0) {\n1184 \t\treturn ret; // #4: missing kfree (victim_name-2)\n1185 \t} else if (!ret) {\n\n1241 \treturn 0;\n1242 }"
}
],
"providerMetadata": {
"dateUpdated": "2026-05-11T13:57:23.382Z",
"orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"shortName": "Linux"
},
"references": [
{
"url": "https://git.kernel.org/stable/c/005d9292b5b2e71a009f911bd85d755009b37242"
},
{
"url": "https://git.kernel.org/stable/c/493ff661d434d6bdf02e3a21adae04d7a0b4265d"
},
{
"url": "https://git.kernel.org/stable/c/f35838a6930296fc1988764cfa54cb3f705c0665"
}
],
"title": "btrfs: fix memory leak in __add_inode_ref()",
"x_generator": {
"engine": "bippy-1.2.0"
}
}
},
"cveMetadata": {
"assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"assignerShortName": "Linux",
"cveId": "CVE-2021-47585",
"datePublished": "2024-06-19T14:53:50.780Z",
"dateReserved": "2024-05-24T15:11:00.731Z",
"dateUpdated": "2026-05-11T13:57:23.382Z",
"state": "PUBLISHED"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.2",
"vulnerability-lookup:meta": {
"epss": {
"cve": "CVE-2021-47585",
"date": "2026-09-15",
"epss": "0.0025",
"percentile": "0.1644"
},
"fkie_nvd": {
"configurations": "[{\"nodes\": [{\"operator\": \"OR\", \"negate\": false, \"cpeMatch\": [{\"vulnerable\": true, \"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"versionStartIncluding\": \"5.5\", \"versionEndExcluding\": \"5.10.88\", \"matchCriteriaId\": \"A657B2D0-5B9D-42BE-A3BF-228DBC1B057C\"}, {\"vulnerable\": true, \"criteria\": \"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\", \"versionStartIncluding\": \"5.11\", \"versionEndExcluding\": \"5.15.11\", \"matchCriteriaId\": \"11274E95-438A-449A-B100-01B2B0046669\"}]}]}]",
"descriptions": "[{\"lang\": \"en\", \"value\": \"In the Linux kernel, the following vulnerability has been resolved:\\n\\nbtrfs: fix memory leak in __add_inode_ref()\\n\\nLine 1169 (#3) allocates a memory chunk for victim_name by kmalloc(),\\nbut when the function returns in line 1184 (#4) victim_name allocated\\nby line 1169 (#3) is not freed, which will lead to a memory leak.\\nThere is a similar snippet of code in this function as allocating a memory\\nchunk for victim_name in line 1104 (#1) as well as releasing the memory\\nin line 1116 (#2).\\n\\nWe should kfree() victim_name when the return value of backref_in_log()\\nis less than zero and before the function returns in line 1184 (#4).\\n\\n1057 static inline int __add_inode_ref(struct btrfs_trans_handle *trans,\\n1058 \\t\\t\\t\\t struct btrfs_root *root,\\n1059 \\t\\t\\t\\t struct btrfs_path *path,\\n1060 \\t\\t\\t\\t struct btrfs_root *log_root,\\n1061 \\t\\t\\t\\t struct btrfs_inode *dir,\\n1062 \\t\\t\\t\\t struct btrfs_inode *inode,\\n1063 \\t\\t\\t\\t u64 inode_objectid, u64 parent_objectid,\\n1064 \\t\\t\\t\\t u64 ref_index, char *name, int namelen,\\n1065 \\t\\t\\t\\t int *search_done)\\n1066 {\\n\\n1104 \\tvictim_name = kmalloc(victim_name_len, GFP_NOFS);\\n\\t// #1: kmalloc (victim_name-1)\\n1105 \\tif (!victim_name)\\n1106 \\t\\treturn -ENOMEM;\\n\\n1112\\tret = backref_in_log(log_root, \u0026search_key,\\n1113\\t\\t\\tparent_objectid, victim_name,\\n1114\\t\\t\\tvictim_name_len);\\n1115\\tif (ret \u003c 0) {\\n1116\\t\\tkfree(victim_name); // #2: kfree (victim_name-1)\\n1117\\t\\treturn ret;\\n1118\\t} else if (!ret) {\\n\\n1169 \\tvictim_name = kmalloc(victim_name_len, GFP_NOFS);\\n\\t// #3: kmalloc (victim_name-2)\\n1170 \\tif (!victim_name)\\n1171 \\t\\treturn -ENOMEM;\\n\\n1180 \\tret = backref_in_log(log_root, \u0026search_key,\\n1181 \\t\\t\\tparent_objectid, victim_name,\\n1182 \\t\\t\\tvictim_name_len);\\n1183 \\tif (ret \u003c 0) {\\n1184 \\t\\treturn ret; // #4: missing kfree (victim_name-2)\\n1185 \\t} else if (!ret) {\\n\\n1241 \\treturn 0;\\n1242 }\"}, {\"lang\": \"es\", \"value\": \"En el kernel de Linux, se resolvi\\u00f3 la siguiente vulnerabilidad: btrfs: corrige la p\\u00e9rdida de memoria en __add_inode_ref() La l\\u00ednea 1169 (#3) asigna un fragmento de memoria para victim_name mediante kmalloc(), pero cuando la funci\\u00f3n regresa en la l\\u00ednea 1184 (#4) victim_name asignado por la l\\u00ednea 1169 (#3) no se libera, lo que provocar\\u00e1 una p\\u00e9rdida de memoria. Hay un fragmento de c\\u00f3digo similar en esta funci\\u00f3n para asignar un fragmento de memoria para victim_name en la l\\u00ednea 1104 (n.\\u00ba 1), as\\u00ed como para liberar la memoria en la l\\u00ednea 1116 (n.\\u00ba 2). Deber\\u00edamos kfree() victim_name cuando el valor de retorno de backref_in_log() sea menor que cero y antes de que la funci\\u00f3n regrese en la l\\u00ednea 1184 (#4). 1057 static inline int __add_inode_ref(struct btrfs_trans_handle *trans, 1058 struct btrfs_root *root, 1059 struct btrfs_path *path, 1060 struct btrfs_root *log_root, 1061 struct btrfs_inode *dir, 1062 struct btrfs_inode *inode, 63 u64 inode_objectid, u64 parent_objectid, 1064 u64 ref_index, char *nombre, int nombrelen, 1065 int *search_done) 1066 { 1104 nombre_v\\u00edctima = kmalloc(nombre_v\\u00edctima_len, GFP_NOFS); // #1: kmalloc (nombre_v\\u00edctima-1) 1105 if (!nombre_v\\u00edctima) 1106 return -ENOMEM; 1112 ret = backref_in_log(log_root, \u0026amp;search_key, 1113 parent_objectid, victim_name, 1114 victim_name_len); 1115 if (ret \u0026lt; 0) { 1116 kfree(nombre_v\\u00edctima); // #2: kfree (nombre_v\\u00edctima-1) 1117 return ret; 1118 } else if (!ret) { 1169 nombre_v\\u00edctima = kmalloc(nombre_v\\u00edctima_len, GFP_NOFS); // #3: kmalloc (nombre_v\\u00edctima-2) 1170 if (!nombre_v\\u00edctima) 1171 return -ENOMEM; 1180 ret = backref_in_log(log_root, \u0026amp;search_key, 1181 parent_objectid, victim_name, 1182 victim_name_len); 1183 si (ret \u0026lt; 0) { 1184 retorno ret; // #4: falta kfree (nombre_v\\u00edctima-2) 1185 } else if (!ret) { 1241 return 0; 1242 }\"}]",
"id": "CVE-2021-47585",
"lastModified": "2024-11-21T06:36:36.300",
"metrics": "{\"cvssMetricV31\": [{\"source\": \"nvd@nist.gov\", \"type\": \"Primary\", \"cvssData\": {\"version\": \"3.1\", \"vectorString\": \"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H\", \"baseScore\": 5.5, \"baseSeverity\": \"MEDIUM\", \"attackVector\": \"LOCAL\", \"attackComplexity\": \"LOW\", \"privilegesRequired\": \"LOW\", \"userInteraction\": \"NONE\", \"scope\": \"UNCHANGED\", \"confidentialityImpact\": \"NONE\", \"integrityImpact\": \"NONE\", \"availabilityImpact\": \"HIGH\"}, \"exploitabilityScore\": 1.8, \"impactScore\": 3.6}]}",
"published": "2024-06-19T15:15:53.057",
"references": "[{\"url\": \"https://git.kernel.org/stable/c/005d9292b5b2e71a009f911bd85d755009b37242\", \"source\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"tags\": [\"Patch\"]}, {\"url\": \"https://git.kernel.org/stable/c/493ff661d434d6bdf02e3a21adae04d7a0b4265d\", \"source\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"tags\": [\"Patch\"]}, {\"url\": \"https://git.kernel.org/stable/c/f35838a6930296fc1988764cfa54cb3f705c0665\", \"source\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"tags\": [\"Patch\"]}, {\"url\": \"https://git.kernel.org/stable/c/005d9292b5b2e71a009f911bd85d755009b37242\", \"source\": \"af854a3a-2127-422b-91ae-364da2661108\", \"tags\": [\"Patch\"]}, {\"url\": \"https://git.kernel.org/stable/c/493ff661d434d6bdf02e3a21adae04d7a0b4265d\", \"source\": \"af854a3a-2127-422b-91ae-364da2661108\", \"tags\": [\"Patch\"]}, {\"url\": \"https://git.kernel.org/stable/c/f35838a6930296fc1988764cfa54cb3f705c0665\", \"source\": \"af854a3a-2127-422b-91ae-364da2661108\", \"tags\": [\"Patch\"]}]",
"sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"vulnStatus": "Modified",
"weaknesses": "[{\"source\": \"nvd@nist.gov\", \"type\": \"Primary\", \"description\": [{\"lang\": \"en\", \"value\": \"CWE-401\"}]}]"
},
"nvd": "{\"cve\":{\"id\":\"CVE-2021-47585\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-06-19T15:15:53.057\",\"lastModified\":\"2026-06-17T04:17:49.000\",\"vulnStatus\":\"Modified\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nbtrfs: fix memory leak in __add_inode_ref()\\n\\nLine 1169 (#3) allocates a memory chunk for victim_name by kmalloc(),\\nbut when the function returns in line 1184 (#4) victim_name allocated\\nby line 1169 (#3) is not freed, which will lead to a memory leak.\\nThere is a similar snippet of code in this function as allocating a memory\\nchunk for victim_name in line 1104 (#1) as well as releasing the memory\\nin line 1116 (#2).\\n\\nWe should kfree() victim_name when the return value of backref_in_log()\\nis less than zero and before the function returns in line 1184 (#4).\\n\\n1057 static inline int __add_inode_ref(struct btrfs_trans_handle *trans,\\n1058 \\t\\t\\t\\t struct btrfs_root *root,\\n1059 \\t\\t\\t\\t struct btrfs_path *path,\\n1060 \\t\\t\\t\\t struct btrfs_root *log_root,\\n1061 \\t\\t\\t\\t struct btrfs_inode *dir,\\n1062 \\t\\t\\t\\t struct btrfs_inode *inode,\\n1063 \\t\\t\\t\\t u64 inode_objectid, u64 parent_objectid,\\n1064 \\t\\t\\t\\t u64 ref_index, char *name, int namelen,\\n1065 \\t\\t\\t\\t int *search_done)\\n1066 {\\n\\n1104 \\tvictim_name = kmalloc(victim_name_len, GFP_NOFS);\\n\\t// #1: kmalloc (victim_name-1)\\n1105 \\tif (!victim_name)\\n1106 \\t\\treturn -ENOMEM;\\n\\n1112\\tret = backref_in_log(log_root, \u0026search_key,\\n1113\\t\\t\\tparent_objectid, victim_name,\\n1114\\t\\t\\tvictim_name_len);\\n1115\\tif (ret \u003c 0) {\\n1116\\t\\tkfree(victim_name); // #2: kfree (victim_name-1)\\n1117\\t\\treturn ret;\\n1118\\t} else if (!ret) {\\n\\n1169 \\tvictim_name = kmalloc(victim_name_len, GFP_NOFS);\\n\\t// #3: kmalloc (victim_name-2)\\n1170 \\tif (!victim_name)\\n1171 \\t\\treturn -ENOMEM;\\n\\n1180 \\tret = backref_in_log(log_root, \u0026search_key,\\n1181 \\t\\t\\tparent_objectid, victim_name,\\n1182 \\t\\t\\tvictim_name_len);\\n1183 \\tif (ret \u003c 0) {\\n1184 \\t\\treturn ret; // #4: missing kfree (victim_name-2)\\n1185 \\t} else if (!ret) {\\n\\n1241 \\treturn 0;\\n1242 }\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se resolvi\u00f3 la siguiente vulnerabilidad: btrfs: corrige la p\u00e9rdida de memoria en __add_inode_ref() La l\u00ednea 1169 (#3) asigna un fragmento de memoria para victim_name mediante kmalloc(), pero cuando la funci\u00f3n regresa en la l\u00ednea 1184 (#4) victim_name asignado por la l\u00ednea 1169 (#3) no se libera, lo que provocar\u00e1 una p\u00e9rdida de memoria. Hay un fragmento de c\u00f3digo similar en esta funci\u00f3n para asignar un fragmento de memoria para victim_name en la l\u00ednea 1104 (n.\u00ba 1), as\u00ed como para liberar la memoria en la l\u00ednea 1116 (n.\u00ba 2). Deber\u00edamos kfree() victim_name cuando el valor de retorno de backref_in_log() sea menor que cero y antes de que la funci\u00f3n regrese en la l\u00ednea 1184 (#4). 1057 static inline int __add_inode_ref(struct btrfs_trans_handle *trans, 1058 struct btrfs_root *root, 1059 struct btrfs_path *path, 1060 struct btrfs_root *log_root, 1061 struct btrfs_inode *dir, 1062 struct btrfs_inode *inode, 63 u64 inode_objectid, u64 parent_objectid, 1064 u64 ref_index, char *nombre, int nombrelen, 1065 int *search_done) 1066 { 1104 nombre_v\u00edctima = kmalloc(nombre_v\u00edctima_len, GFP_NOFS); // #1: kmalloc (nombre_v\u00edctima-1) 1105 if (!nombre_v\u00edctima) 1106 return -ENOMEM; 1112 ret = backref_in_log(log_root, \u0026amp;search_key, 1113 parent_objectid, victim_name, 1114 victim_name_len); 1115 if (ret \u0026lt; 0) { 1116 kfree(nombre_v\u00edctima); // #2: kfree (nombre_v\u00edctima-1) 1117 return ret; 1118 } else if (!ret) { 1169 nombre_v\u00edctima = kmalloc(nombre_v\u00edctima_len, GFP_NOFS); // #3: kmalloc (nombre_v\u00edctima-2) 1170 if (!nombre_v\u00edctima) 1171 return -ENOMEM; 1180 ret = backref_in_log(log_root, \u0026amp;search_key, 1181 parent_objectid, victim_name, 1182 victim_name_len); 1183 si (ret \u0026lt; 0) { 1184 retorno ret; // #4: falta kfree (nombre_v\u00edctima-2) 1185 } else if (!ret) { 1241 return 0; 1242 }\"}],\"affected\":[{\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"affectedData\":[{\"vendor\":\"Linux\",\"product\":\"Linux\",\"defaultStatus\":\"unaffected\",\"programFiles\":[\"fs/btrfs/tree-log.c\"],\"repo\":\"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\",\"versions\":[{\"version\":\"d3316c8233bb05e0dd855d30aac347bb8ad76ee4\",\"lessThan\":\"005d9292b5b2e71a009f911bd85d755009b37242\",\"versionType\":\"git\",\"status\":\"affected\"},{\"version\":\"d3316c8233bb05e0dd855d30aac347bb8ad76ee4\",\"lessThan\":\"493ff661d434d6bdf02e3a21adae04d7a0b4265d\",\"versionType\":\"git\",\"status\":\"affected\"},{\"version\":\"d3316c8233bb05e0dd855d30aac347bb8ad76ee4\",\"lessThan\":\"f35838a6930296fc1988764cfa54cb3f705c0665\",\"versionType\":\"git\",\"status\":\"affected\"}]},{\"vendor\":\"Linux\",\"product\":\"Linux\",\"defaultStatus\":\"affected\",\"programFiles\":[\"fs/btrfs/tree-log.c\"],\"repo\":\"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\",\"versions\":[{\"version\":\"5.5\",\"status\":\"affected\"},{\"version\":\"0\",\"lessThan\":\"5.5\",\"versionType\":\"semver\",\"status\":\"unaffected\"},{\"version\":\"5.10.88\",\"lessThanOrEqual\":\"5.10.*\",\"versionType\":\"semver\",\"status\":\"unaffected\"},{\"version\":\"5.15.11\",\"lessThanOrEqual\":\"5.15.*\",\"versionType\":\"semver\",\"status\":\"unaffected\"},{\"version\":\"5.16\",\"lessThanOrEqual\":\"*\",\"versionType\":\"original_commit_for_fix\",\"status\":\"unaffected\"}]}]}],\"metrics\":{\"cvssMetricV31\":[{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H\",\"baseScore\":5.5,\"baseSeverity\":\"MEDIUM\",\"attackVector\":\"LOCAL\",\"attackComplexity\":\"LOW\",\"privilegesRequired\":\"LOW\",\"userInteraction\":\"NONE\",\"scope\":\"UNCHANGED\",\"confidentialityImpact\":\"NONE\",\"integrityImpact\":\"NONE\",\"availabilityImpact\":\"HIGH\"},\"exploitabilityScore\":1.8,\"impactScore\":3.6}],\"ssvcV203\":[{\"source\":\"134c704f-9b21-4f2e-91b3-4a467353bcc0\",\"ssvcData\":{\"timestamp\":\"2024-06-24T18:08:01.516987Z\",\"id\":\"CVE-2021-47585\",\"options\":[{\"exploitation\":\"none\"},{\"automatable\":\"no\"},{\"technicalImpact\":\"partial\"}],\"role\":\"CISA Coordinator\",\"version\":\"2.0.3\"}}]},\"weaknesses\":[{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"description\":[{\"lang\":\"en\",\"value\":\"CWE-401\"}]}],\"configurations\":[{\"nodes\":[{\"operator\":\"OR\",\"negate\":false,\"cpeMatch\":[{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.5\",\"versionEndExcluding\":\"5.10.88\",\"matchCriteriaId\":\"A657B2D0-5B9D-42BE-A3BF-228DBC1B057C\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.11\",\"versionEndExcluding\":\"5.15.11\",\"matchCriteriaId\":\"11274E95-438A-449A-B100-01B2B0046669\"}]}]}],\"references\":[{\"url\":\"https://git.kernel.org/stable/c/005d9292b5b2e71a009f911bd85d755009b37242\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/493ff661d434d6bdf02e3a21adae04d7a0b4265d\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/f35838a6930296fc1988764cfa54cb3f705c0665\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/005d9292b5b2e71a009f911bd85d755009b37242\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/493ff661d434d6bdf02e3a21adae04d7a0b4265d\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/f35838a6930296fc1988764cfa54cb3f705c0665\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Patch\"]}]}}",
"redhat_vex": {
"aggregate_severity": "Low",
"current_release_date": "2025-11-21T14:39:58+00:00",
"cve": "CVE-2021-47585",
"id": "CVE-2021-47585",
"initial_release_date": "2021-01-01T00:00:00+00:00",
"product_status:known_affected": "42",
"product_status:known_not_affected": "156",
"source": "Red Hat CSAF VEX",
"status": "final",
"title": "kernel: btrfs: fix memory leak in __add_inode_ref()",
"url": "https://security.access.redhat.com/data/csaf/v2/vex/2021/cve-2021-47585.json",
"version": "3"
},
"suse_vex": {
"aggregate_severity": "moderate",
"current_release_date": "2026-09-11T02:36:50Z",
"cve": "CVE-2021-47585",
"id": "CVE-2021-47585",
"initial_release_date": "2024-06-21T03:52:30Z",
"product_status:known_affected": "330",
"product_status:known_not_affected": "254",
"product_status:recommended": "391",
"source": "SUSE CSAF VEX",
"status": "interim",
"title": "SUSE CVE CVE-2021-47585",
"url": "https://ftp.suse.com/pub/projects/security/csaf-vex/cve-2021-47585.json",
"version": "52"
},
"vulnrichment": {
"containers": "{\"adp\": [{\"title\": \"CVE Program Container\", \"references\": [{\"url\": \"https://git.kernel.org/stable/c/005d9292b5b2e71a009f911bd85d755009b37242\", \"tags\": [\"x_transferred\"]}, {\"url\": \"https://git.kernel.org/stable/c/493ff661d434d6bdf02e3a21adae04d7a0b4265d\", \"tags\": [\"x_transferred\"]}, {\"url\": \"https://git.kernel.org/stable/c/f35838a6930296fc1988764cfa54cb3f705c0665\", \"tags\": [\"x_transferred\"]}], \"providerMetadata\": {\"orgId\": \"af854a3a-2127-422b-91ae-364da2661108\", \"shortName\": \"CVE\", \"dateUpdated\": \"2024-08-04T05:39:59.778Z\"}}, {\"title\": \"CISA ADP Vulnrichment\", \"metrics\": [{\"other\": {\"type\": \"ssvc\", \"content\": {\"id\": \"CVE-2021-47585\", \"role\": \"CISA Coordinator\", \"options\": [{\"Exploitation\": \"none\"}, {\"Automatable\": \"no\"}, {\"Technical Impact\": \"partial\"}], \"version\": \"2.0.3\", \"timestamp\": \"2024-06-24T18:08:01.516987Z\"}}}], \"providerMetadata\": {\"orgId\": \"134c704f-9b21-4f2e-91b3-4a467353bcc0\", \"shortName\": \"CISA-ADP\", \"dateUpdated\": \"2024-06-24T18:08:06.072Z\"}}], \"cna\": {\"title\": \"btrfs: fix memory leak in __add_inode_ref()\", \"affected\": [{\"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\", \"vendor\": \"Linux\", \"product\": \"Linux\", \"versions\": [{\"status\": \"affected\", \"version\": \"d3316c8233bb05e0dd855d30aac347bb8ad76ee4\", \"lessThan\": \"005d9292b5b2e71a009f911bd85d755009b37242\", \"versionType\": \"git\"}, {\"status\": \"affected\", \"version\": \"d3316c8233bb05e0dd855d30aac347bb8ad76ee4\", \"lessThan\": \"493ff661d434d6bdf02e3a21adae04d7a0b4265d\", \"versionType\": \"git\"}, {\"status\": \"affected\", \"version\": \"d3316c8233bb05e0dd855d30aac347bb8ad76ee4\", \"lessThan\": \"f35838a6930296fc1988764cfa54cb3f705c0665\", \"versionType\": \"git\"}], \"programFiles\": [\"fs/btrfs/tree-log.c\"], \"defaultStatus\": \"unaffected\"}, {\"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\", \"vendor\": \"Linux\", \"product\": \"Linux\", \"versions\": [{\"status\": \"affected\", \"version\": \"5.5\"}, {\"status\": \"unaffected\", \"version\": \"0\", \"lessThan\": \"5.5\", \"versionType\": \"semver\"}, {\"status\": \"unaffected\", \"version\": \"5.10.88\", \"versionType\": \"semver\", \"lessThanOrEqual\": \"5.10.*\"}, {\"status\": \"unaffected\", \"version\": \"5.15.11\", \"versionType\": \"semver\", \"lessThanOrEqual\": \"5.15.*\"}, {\"status\": \"unaffected\", \"version\": \"5.16\", \"versionType\": \"original_commit_for_fix\", \"lessThanOrEqual\": \"*\"}], \"programFiles\": [\"fs/btrfs/tree-log.c\"], \"defaultStatus\": \"affected\"}], \"references\": [{\"url\": \"https://git.kernel.org/stable/c/005d9292b5b2e71a009f911bd85d755009b37242\"}, {\"url\": \"https://git.kernel.org/stable/c/493ff661d434d6bdf02e3a21adae04d7a0b4265d\"}, {\"url\": \"https://git.kernel.org/stable/c/f35838a6930296fc1988764cfa54cb3f705c0665\"}], \"x_generator\": {\"engine\": \"bippy-5f407fcff5a0\"}, \"descriptions\": [{\"lang\": \"en\", \"value\": \"In the Linux kernel, the following vulnerability has been resolved:\\n\\nbtrfs: fix memory leak in __add_inode_ref()\\n\\nLine 1169 (#3) allocates a memory chunk for victim_name by kmalloc(),\\nbut when the function returns in line 1184 (#4) victim_name allocated\\nby line 1169 (#3) is not freed, which will lead to a memory leak.\\nThere is a similar snippet of code in this function as allocating a memory\\nchunk for victim_name in line 1104 (#1) as well as releasing the memory\\nin line 1116 (#2).\\n\\nWe should kfree() victim_name when the return value of backref_in_log()\\nis less than zero and before the function returns in line 1184 (#4).\\n\\n1057 static inline int __add_inode_ref(struct btrfs_trans_handle *trans,\\n1058 \\t\\t\\t\\t struct btrfs_root *root,\\n1059 \\t\\t\\t\\t struct btrfs_path *path,\\n1060 \\t\\t\\t\\t struct btrfs_root *log_root,\\n1061 \\t\\t\\t\\t struct btrfs_inode *dir,\\n1062 \\t\\t\\t\\t struct btrfs_inode *inode,\\n1063 \\t\\t\\t\\t u64 inode_objectid, u64 parent_objectid,\\n1064 \\t\\t\\t\\t u64 ref_index, char *name, int namelen,\\n1065 \\t\\t\\t\\t int *search_done)\\n1066 {\\n\\n1104 \\tvictim_name = kmalloc(victim_name_len, GFP_NOFS);\\n\\t// #1: kmalloc (victim_name-1)\\n1105 \\tif (!victim_name)\\n1106 \\t\\treturn -ENOMEM;\\n\\n1112\\tret = backref_in_log(log_root, \u0026search_key,\\n1113\\t\\t\\tparent_objectid, victim_name,\\n1114\\t\\t\\tvictim_name_len);\\n1115\\tif (ret \u003c 0) {\\n1116\\t\\tkfree(victim_name); // #2: kfree (victim_name-1)\\n1117\\t\\treturn ret;\\n1118\\t} else if (!ret) {\\n\\n1169 \\tvictim_name = kmalloc(victim_name_len, GFP_NOFS);\\n\\t// #3: kmalloc (victim_name-2)\\n1170 \\tif (!victim_name)\\n1171 \\t\\treturn -ENOMEM;\\n\\n1180 \\tret = backref_in_log(log_root, \u0026search_key,\\n1181 \\t\\t\\tparent_objectid, victim_name,\\n1182 \\t\\t\\tvictim_name_len);\\n1183 \\tif (ret \u003c 0) {\\n1184 \\t\\treturn ret; // #4: missing kfree (victim_name-2)\\n1185 \\t} else if (!ret) {\\n\\n1241 \\treturn 0;\\n1242 }\"}], \"providerMetadata\": {\"orgId\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"shortName\": \"Linux\", \"dateUpdated\": \"2024-12-19T07:45:15.543Z\"}}}",
"cveMetadata": "{\"cveId\": \"CVE-2021-47585\", \"state\": \"PUBLISHED\", \"dateUpdated\": \"2024-12-19T07:45:15.543Z\", \"dateReserved\": \"2024-05-24T15:11:00.731Z\", \"assignerOrgId\": \"416baaa9-dc9f-4396-8d5f-8c081fb06d67\", \"datePublished\": \"2024-06-19T14:53:50.780Z\", \"assignerShortName\": \"Linux\"}",
"dataType": "CVE_RECORD",
"dataVersion": "5.1"
}
}
}
Loading…
Loading…
Experimental. This forecast is provided for visualization only and may change without notice. Do not use it for operational decisions.
Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Loading…
The MITRE ATT&CK techniques below are AI-generated suggestions, inferred from the description of the
vulnerability by the CIRCL/vulnerability-attack-technique-classification-roberta-base
model, served locally by ML-Gateway.
They have not been verified by an analyst and are provided for guidance only.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Loading…
Loading…