CVE-2021-47218
kernel: selinux: fix NULL-pointer dereference when hashtab allocation fails
Severity
ModerateRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · April 10, 2024
Updated · November 21, 2025
Description
A vulnerability was found in the Linux kernel, related to SELinux. This issue occurs when a hash table allocation fails during the hashtab_init() function. When this failure happens, the system leaves the hash table (h->size) initialized with a non-zero value, but the h->htable pointer remains null. This can result in a null pointer dereference when SELinux's policy database tries to use the hash table, relying on the assumption that it is valid. This situation can cause system crashes or unexpected behavior.
Statement
The fix for this issue ensures that even in the case of allocation failure, hashtab_init() leaves behind a valid empty hash table, preventing the null pointer dereference and improving the stability of SELinux in this context
CVSS score applicability
The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.
Mitigation
No mitigation is specified in collected source.
CVSS / CWE
CVSS 3.1 · 4.4CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H
CWE-476 · NULL Pointer Dereference