CVE-2021-47258·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: scsi: core: Fix error handling of scsi_host_alloc() After device is initialized via device_initialize(), or its name is set via dev_set_name(), the device has to be freed via put_device(). Otherwise device name will be leaked because it is allocated dynamically in dev_set_name(). Fix the leak by replacing kfree() with put_device(). Since scsi_host_dev_release() properly handles IDA and kthread removal, remove special-casing these from the error handling as well.
- Severity
- medium
- Software
- Kernel
- Fixed in
- 5.12.11
- Published
- 2024-05-21
Affected versions
From: 5.11
Until: 5.12.11
Fixed in: 5.12.11
How to fix this CVE
Update your Linux kernel to version 5.12.11 or later to patch a memory leak in SCSI host allocation error handling. The vulnerability occurs when device initialization fails, causing improper cleanup of dynamically allocated device names. Apply the kernel update through your distribution's package manager and reboot to fully remediate.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Step 1: Check your current kernel version with `uname -r` and compare against 5.12.11 — versions 5.11.x through 5.12.10 are vulnerable
- Step 2: Verify SCSI subsystem is active on your system with `lsmod | grep scsi` — if not present, local exposure is minimal but kernel should still be updated
- Step 3: Search kernel logs for SCSI host allocation failures using `journalctl -b | grep -i 'scsi_host_alloc\|device.*leak'` to identify if this code path was triggered
- Step 4: After updating, verify the new kernel is running with `uname -r` and confirm it reports version 5.12.11 or later
FAQ
What is CVE-2021-47258?
This vulnerability is a memory leak in the Linux kernel's SCSI core subsystem. When SCSI host allocation fails after device initialization, the kernel fails to properly release dynamically allocated device names, causing kernel memory to be consumed until system resources are exhausted.
Is CVE-2021-47258 being actively exploited?
No, there are no public exploits available and CISA has not identified active exploitation of this vulnerability in the wild.
What versions of Kernel are affected by CVE-2021-47258?
Linux kernel versions 5.11 through 5.12.10 are vulnerable. The fix was integrated into kernel 5.12.11 and later stable branches.
How do I check if my server is vulnerable to CVE-2021-47258?
Run `uname -r` to display your kernel version. If it shows 5.11.x or 5.12.0 through 5.12.10, your system is vulnerable and requires a kernel update.
Does Defensia detect CVE-2021-47258?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If the Linux kernel is installed on a monitored server, CVE-2021-47258 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- https://git.kernel.org/stable/c/2dc85045ae65b9302a1d2e2ddd7ce4c030153a6a
- https://git.kernel.org/stable/c/45d83db4728127944b237c0c8248987df9d478e7
- https://git.kernel.org/stable/c/66a834d092930cf41d809c0e989b13cd6f9ca006
- https://git.kernel.org/stable/c/79296e292d67fa7b5fb8d8c27343683e823872c8
- https://git.kernel.org/stable/c/7a696ce1d5d16a33a6cd6400bbcc0339b2460e11
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2021-47258. Free for 1 server.
Get started free