{"id":"CVE-2021-47482","aliases":["CVE-2021-47482"],"related":[],"kind":"vulnerability","state":"published","title":"net: batman-adv: fix error handling","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: batman-adv: fix error handling\n\nSyzbot reported ODEBUG warning in batadv_nc_mesh_free(). The problem was\nin wrong error handling in batadv_mesh_init().\n\nBefore this patch batadv_mesh_init() was calling batadv_mesh_free() in case\nof any batadv_*_init() calls failure. This approach may work well, when\nthere is some kind of indicator, which can tell which parts of batadv are\ninitialized; but there isn't any.\n\nAll written above lead to cleaning up uninitialized fields. Even if we hide\nODEBUG warning by initializing bat_priv->nc.work, syzbot was able to hit\nGPF in batadv_nc_purge_paths(), because hash pointer in still NULL. [1]\n\nTo fix these bugs we can unwind batadv_*_init() calls one by one.\nIt is good approach for 2 reasons: 1) It fixes bugs on error handling\npath 2) It improves the performance, since we won't call unneeded\nbatadv_*_free() functions.\n\nSo, this patch makes all batadv_*_init() clean up all allocated memory\nbefore returning with an error to no call correspoing batadv_*_free()\nand open-codes batadv_mesh_free() with proper order to avoid touching\nuninitialized fields.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: batman-adv: fix error handling\n\nSyzbot reported ODEBUG warning in batadv_nc_mesh_free(). The problem was\nin wrong error handling in batadv_mesh_init().\n\nBefore this patch batadv_mesh_init() was calling batadv_mesh_free() in case\nof any batadv_*_init() calls failure. This approach may work well, when\nthere is some kind of indicator, which can tell which parts of batadv are\ninitialized; but there isn't any.\n\nAll written above lead to cleaning up uninitialized fields. Even if we hide\nODEBUG warning by initializing bat_priv->nc.work, syzbot was able to hit\nGPF in batadv_nc_purge_paths(), because hash pointer in still NULL. [1]\n\nTo fix these bugs we can unwind batadv_*_init() calls one by one.\nIt is good approach for 2 reasons: 1) It fixes bugs on error handling\npath 2) It improves the performance, since we won't call unneeded\nbatadv_*_free() functions.\n\nSo, this patch makes all batadv_*_init() clean up all allocated memory\nbefore returning with an error to no call correspoing batadv_*_free()\nand open-codes batadv_mesh_free() with proper order to avoid touching\nuninitialized fields.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: net: batman-adv: corrección de manejo de errores Syzbot informó advertencia ODEBUG en batadv_nc_mesh_free(). El problema estaba en el manejo incorrecto de errores en batadv_mesh_init(). Antes de este parche, batadv_mesh_init() llamaba a batadv_mesh_free() en caso de que fallara alguna llamada a batadv_*_init(). Este enfoque puede funcionar bien cuando hay algún tipo de indicador que puede indicar qué partes de batadv están inicializadas; pero no hay ninguno. Todo lo escrito anteriormente conduce a la sanitización de campos no inicializados. Incluso si ocultamos la advertencia ODEBUG inicializando bat_priv-&gt;nc.work, syzbot pudo presionar GPF en batadv_nc_purge_paths(), porque el puntero hash todavía es NULL. [1] Para corregir estos errores podemos desenredar las llamadas batadv_*_init() una por una. Es un buen enfoque por 2 razones: 1) Corrige errores en la ruta de manejo de errores 2) Mejora el rendimiento, ya que no llamaremos a funciones batadv_*_free() innecesarias. Entonces, este parche hace que batadv_*_init() limpie toda la memoria asignada antes de regresar con un error de no llamada correspondiente a batadv_*_free() y códigos abiertos batadv_mesh_free() con el orden adecuado para evitar tocar campos no inicializados.","source":"nvd"}],"published":"2024-05-22T08:19:34.174Z","modified":"2026-06-17T04:17:35.843Z","severity":{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.3,"rating":"MEDIUM"}],"cwes":["CWE-544"],"affected":[{"ranges":[{"type":"git","introduced":"c6c8fea29769d998d94fcec9b9f14d4b52b349d3","fixed":"0c6b199f09be489c48622537a550787fc80aea73","status":"affected"},{"type":"git","introduced":"c6c8fea29769d998d94fcec9b9f14d4b52b349d3","fixed":"07533f1a673ce1126d0a72ef1e4b5eaaa3dd6d20","status":"affected"},{"type":"git","introduced":"c6c8fea29769d998d94fcec9b9f14d4b52b349d3","fixed":"e50f957652190b5a88a8ebce7e5ab14ebd0d3f00","status":"affected"},{"type":"git","introduced":"c6c8fea29769d998d94fcec9b9f14d4b52b349d3","fixed":"fbf150b16a3635634b7dfb7f229d8fcd643c6c51","status":"affected"},{"type":"git","introduced":"c6c8fea29769d998d94fcec9b9f14d4b52b349d3","fixed":"6422e8471890273994fe8cc6d452b0dcd2c9483e","status":"affected"},{"type":"git","introduced":"c6c8fea29769d998d94fcec9b9f14d4b52b349d3","fixed":"b0a2cd38553c77928ef1646ed1518486b1e70ae8","status":"affected"},{"type":"git","introduced":"c6c8fea29769d998d94fcec9b9f14d4b52b349d3","fixed":"a8f7359259dd5923adc6129284fdad12fc5db347","status":"affected"},{"type":"git","introduced":"c6c8fea29769d998d94fcec9b9f14d4b52b349d3","fixed":"6f68cd634856f8ca93bafd623ba5357e0f648c68","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"2.6.38","status":"affected"},{"type":"semver","introduced":"0","fixed":"2.6.38","status":"unaffected"},{"type":"semver","introduced":"4.4.293","lastAffected":"4.4.*","status":"unaffected"},{"type":"semver","introduced":"4.9.289","lastAffected":"4.9.*","status":"unaffected"},{"type":"semver","introduced":"4.14.254","lastAffected":"4.14.*","status":"unaffected"},{"type":"semver","introduced":"4.19.215","lastAffected":"4.19.*","status":"unaffected"},{"type":"semver","introduced":"5.4.157","lastAffected":"5.4.*","status":"unaffected"},{"type":"semver","introduced":"5.10.77","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.14.16","lastAffected":"5.14.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"5.15","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"type":"custom","introduced":"c6c8fea29769","fixed":"6f68cd634856","status":"affected"}],"vendor":"linux","product":"kernel","cpe":"cpe:2.3:a:linux:kernel:*:*:*:*:*:*:*:*","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"2.6.38","fixed":"4.4.293"},{"status":"affected","introduced":"4.5","fixed":"4.9.289"},{"status":"affected","introduced":"4.10","fixed":"4.14.254"},{"status":"affected","introduced":"4.15","fixed":"4.19.215"},{"status":"affected","introduced":"4.20","fixed":"5.4.157"},{"status":"affected","introduced":"5.5","fixed":"5.10.77"},{"status":"affected","introduced":"5.11","fixed":"5.14.16"},{"status":"affected","version":"5.15"},{"status":"affected","version":"5.15"},{"status":"affected","version":"5.15"},{"status":"affected","version":"5.15"},{"status":"affected","version":"5.15"},{"status":"affected","version":"5.15"},{"status":"affected","version":"5.15"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/0c6b199f09be489c48622537a550787fc80aea73","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/07533f1a673ce1126d0a72ef1e4b5eaaa3dd6d20","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/e50f957652190b5a88a8ebce7e5ab14ebd0d3f00","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/fbf150b16a3635634b7dfb7f229d8fcd643c6c51","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/6422e8471890273994fe8cc6d452b0dcd2c9483e","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/b0a2cd38553c77928ef1646ed1518486b1e70ae8","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/a8f7359259dd5923adc6129284fdad12fc5db347","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/6f68cd634856f8ca93bafd623ba5357e0f648c68","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-05-22T14:23:49.834Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-47482","url":"https://www.cve.org/CVERecord?id=CVE-2021-47482","licence":"CVE Terms of Use","modified":"2026-05-11T13:55:32.415Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-47482","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-47482","licence":"Public domain","modified":"2026-06-17T04:17:35.843Z"}],"updatedAt":"2026-11-25T22:58:08.879Z","epss":{"score":0.00739,"percentile":0.55818,"date":"2026-12-02T12:00:21.000Z"}}