{"id":"CVE-2021-47218","aliases":["CVE-2021-47218"],"related":[],"kind":"vulnerability","state":"published","title":"selinux: fix NULL-pointer dereference when hashtab allocation fails","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nselinux: fix NULL-pointer dereference when hashtab allocation fails\n\nWhen the hash table slot array allocation fails in hashtab_init(),\nh->size is left initialized with a non-zero value, but the h->htable\npointer is NULL. This may then cause a NULL pointer dereference, since\nthe policydb code relies on the assumption that even after a failed\nhashtab_init(), hashtab_map() and hashtab_destroy() can be safely called\non it. Yet, these detect an empty hashtab only by looking at the size.\n\nFix this by making sure that hashtab_init() always leaves behind a valid\nempty hashtab when the allocation fails.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nselinux: fix NULL-pointer dereference when hashtab allocation fails\n\nWhen the hash table slot array allocation fails in hashtab_init(),\nh->size is left initialized with a non-zero value, but the h->htable\npointer is NULL. This may then cause a NULL pointer dereference, since\nthe policydb code relies on the assumption that even after a failed\nhashtab_init(), hashtab_map() and hashtab_destroy() can be safely called\non it. Yet, these detect an empty hashtab only by looking at the size.\n\nFix this by making sure that hashtab_init() always leaves behind a valid\nempty hashtab when the allocation fails.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: selinux: corregir la desreferencia de puntero NULL cuando falla la asignación de hashtab Cuando la asignación de la matriz de ranuras de la tabla hash falla en hashtab_init(), h-&gt;size se deja inicializado con un valor distinto de cero, pero el puntero h-&gt;htable es NULL. Esto puede causar una desreferencia de puntero NULL, ya que el código policydb se basa en la suposición de que incluso después de un hashtab_init() fallido, se pueden llamar hashtab_map() y hashtab_destroy() de forma segura. Sin embargo, estos detectan un hashtab vacío solo mirando el tamaño. Solucione esto asegurándose de que hashtab_init() siempre deje atrás un hashtab vacío válido cuando falla la asignación.","source":"nvd"}],"published":"2024-04-10T19:01:57.060Z","modified":"2026-06-17T04:16:56.023Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"}],"cwes":["CWE-476"],"affected":[{"ranges":[{"type":"git","introduced":"03414a49ad5f3c56988c36d2070e402ffa17feaf","fixed":"b17dd53cac769dd13031b0ca34f90cc65e523fab","status":"affected"},{"type":"git","introduced":"03414a49ad5f3c56988c36d2070e402ffa17feaf","fixed":"83c8ab8503adf56bf68dafc7a382f4946c87da79","status":"affected"},{"type":"git","introduced":"03414a49ad5f3c56988c36d2070e402ffa17feaf","fixed":"dc27f3c5d10c58069672215787a96b4fae01818b","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"5.8","status":"affected"},{"type":"semver","introduced":"0","fixed":"5.8","status":"unaffected"},{"type":"semver","introduced":"5.10.82","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.5","lastAffected":"5.15.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"5.16","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"5.8","fixed":"5.10.82"},{"status":"affected","introduced":"5.11","fixed":"5.15.5"},{"status":"affected","version":"5.16"},{"status":"affected","version":"5.16"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/b17dd53cac769dd13031b0ca34f90cc65e523fab","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/83c8ab8503adf56bf68dafc7a382f4946c87da79","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/dc27f3c5d10c58069672215787a96b4fae01818b","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2024-04-15T15:01:50.328Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-47218","url":"https://www.cve.org/CVERecord?id=CVE-2021-47218","licence":"CVE Terms of Use","modified":"2026-05-11T13:50:16.030Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-47218","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-47218","licence":"Public domain","modified":"2026-06-17T04:16:56.023Z"}],"updatedAt":"2026-11-25T22:58:08.722Z","epss":{"score":0.00225,"percentile":0.14053,"date":"2026-12-01T12:00:22.000Z"}}