CVE-2021-47483: regmap: Fix possible double-free in regcache_rbtree_exit()
In the Linux kernel, the following vulnerability has been resolved:
regmap: Fix possible double-free in regcacherbtreeexit()
In regcacherbtreeinserttoblock(), when 'present' realloc failed, the 'blk' which is supposed to assign to 'rbnode->block' will be freed, so 'rbnode->block' points a freed memory, in the error handling path of regcacherbtreeinit(), 'rbnode->block' will be freed again in regcacherbtreeexit(), KASAN will report double-free as follows:
BUG: KASAN: double-free or invalid-free in kfree+0xce/0x390 Call Trace: slabfreefreelisthook+0x10d/0x240 kfree+0xce/0x390 regcacherbtreeexit+0x15d/0x1a0 regcacherbtreeinit+0x224/0x2c0 regcacheinit+0x88d/0x1310 regmapinit+0x3151/0x4a80 devmregmapinit+0x7d/0x100 maderaspiprobe+0x10f/0x333 [maderaspi] spiprobe+0x183/0x210 reallyprobe+0x285/0xc30
To fix this, moving up the assignment of rbnode->block to immediately after the reallocation has succeeded so that the data structure stays valid even if the second reallocation fails.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.135-1Fixed in 6.12.27-1
Event History
Frequently Asked Questions
What is the severity of CVE-2021-47483?
CVE-2021-47483 has a high severity rating due to potential double-free vulnerabilities in the Linux kernel.
What software versions are affected by CVE-2021-47483?
CVE-2021-47483 affects various versions of the Linux kernel including versions 3.12 to 4.4.291, 4.5 to 4.9.289, 4.10 to 4.14.254, among others.
How do I fix CVE-2021-47483?
To fix CVE-2021-47483, upgrade to the latest stable version of the Linux kernel that addresses this vulnerability.
What type of vulnerability is CVE-2021-47483?
CVE-2021-47483 is classified as a memory corruption vulnerability resulting from improper handling of memory allocation.
Can CVE-2021-47483 be exploited remotely?
Exploitation of CVE-2021-47483 may require local access to the system, which reduces the risk of remote exploitation.