CVE-2021-47455: ptp: Fix possible memory leak in ptp_clock_register()
In the Linux kernel, the following vulnerability has been resolved:
ptp: Fix possible memory leak in ptpclockregister()
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff88800906c618 (size 8): comm "i2c-idt82p33931", pid 4421, jiffies 4294948083 (age 13.188s) hex dump (first 8 bytes): 70 74 70 30 00 00 00 00 ptp0.... backtrace: [<00000000312ed458>] kmalloctrackcaller+0x19f/0x3a0 [<0000000079f6e2ff>] kvasprintf+0xb5/0x150 [<0000000026aae54f>] kvasprintfconst+0x60/0x190 [<00000000f323a5f7>] kobjectsetnamevargs+0x56/0x150 [<000000004e35abdd>] devsetname+0xc0/0x100 [<00000000f20cfe25>] ptpclockregister+0x9f4/0xd30 [ptp] [<000000008bb9f0de>] idt82p33probe.cold+0x8b6/0x1561 [ptpidt82p33]
When posixclockregister() returns an error, the name allocated in devsetname() will be leaked, the putdevice() should be used to give up the device reference, then the name will be freed in kobjectcleanup() and other memory will be freed in ptpclockrelease().
Other sources
In the Linux kernel, the following vulnerability has been resolved:
ptp: Fix possible memory leak in ptpclockregister()
The Linux kernel CVE team has assigned CVE-2021-47455 to this issue.
Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024052244-CVE-2021-47455-c4a1@gregkh/T
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 5.14.15 - Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 5.15 - Compensating control
In ptp_clock_register(), call put_device() when posix_clock_register() returns an error so the device reference is released and the allocated name is freed during kobject_cleanup().
Event History
Frequently Asked Questions
What is the severity of CVE-2021-47455?
CVE-2021-47455 is classified as a moderate severity vulnerability due to the potential for a memory leak in the Linux kernel.
How do I fix CVE-2021-47455?
To fix CVE-2021-47455, update the Linux kernel to version 5.14.15 or 5.15.
What is the impact of CVE-2021-47455 on system performance?
The impact of CVE-2021-47455 may lead to increased memory usage over time, potentially degrading system performance.
Which systems are affected by CVE-2021-47455?
CVE-2021-47455 affects certain versions of the Linux kernel, specifically those before 5.14.15 and 5.15.
Are there specific distributions impacted by CVE-2021-47455?
Red Hat and other distributions utilizing vulnerable versions of the Linux kernel are impacted by CVE-2021-47455.