CVE-2021-47483

Severity CVSS v4.0:
Pending analysis
Type:
CWE-415 Double Free
Publication date:
22/05/2024
Last modified:
06/01/2025

Description

In the Linux kernel, the following vulnerability has been resolved:<br /> <br /> regmap: Fix possible double-free in regcache_rbtree_exit()<br /> <br /> In regcache_rbtree_insert_to_block(), when &amp;#39;present&amp;#39; realloc failed,<br /> the &amp;#39;blk&amp;#39; which is supposed to assign to &amp;#39;rbnode-&gt;block&amp;#39; will be freed,<br /> so &amp;#39;rbnode-&gt;block&amp;#39; points a freed memory, in the error handling path of<br /> regcache_rbtree_init(), &amp;#39;rbnode-&gt;block&amp;#39; will be freed again in<br /> regcache_rbtree_exit(), KASAN will report double-free as follows:<br /> <br /> BUG: KASAN: double-free or invalid-free in kfree+0xce/0x390<br /> Call Trace:<br /> slab_free_freelist_hook+0x10d/0x240<br /> kfree+0xce/0x390<br /> regcache_rbtree_exit+0x15d/0x1a0<br /> regcache_rbtree_init+0x224/0x2c0<br /> regcache_init+0x88d/0x1310<br /> __regmap_init+0x3151/0x4a80<br /> __devm_regmap_init+0x7d/0x100<br /> madera_spi_probe+0x10f/0x333 [madera_spi]<br /> spi_probe+0x183/0x210<br /> really_probe+0x285/0xc30<br /> <br /> To fix this, moving up the assignment of rbnode-&gt;block to immediately after<br /> the reallocation has succeeded so that the data structure stays valid even<br /> if the second reallocation fails.

Vulnerable products and versions

CPE From Up to
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 3.12 (including) 4.4.291 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.5 (including) 4.9.289 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.10 (including) 4.14.254 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.15 (including) 4.19.215 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 4.20 (including) 5.4.157 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.5 (including) 5.10.77 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.11 (including) 5.14.16 (excluding)
cpe:2.3:o:linux:linux_kernel:5.15:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:5.15:rc2:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:5.15:rc3:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:5.15:rc4:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:5.15:rc5:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:5.15:rc6:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:5.15:rc7:*:*:*:*:*:*