CVE-2021-47483

Source
https://cve.org/CVERecord?id=CVE-2021-47483
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-47483.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2021-47483
Downstream
Related
Published
2024-05-22T09:15:10.227Z
Modified
2026-03-10T23:52:24.946548Z
Severity
  • 7.8 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
[none]
Details

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 __regmap_init+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.

References

Affected packages

Git /

Affected ranges

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-47483.json"
unresolved_ranges
[
    {
        "events": [
            {
                "introduced": "3.12"
            },
            {
                "fixed": "4.4.291"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "4.5"
            },
            {
                "fixed": "4.9.289"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "4.10"
            },
            {
                "fixed": "4.14.254"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "4.15"
            },
            {
                "fixed": "4.19.215"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "4.20"
            },
            {
                "fixed": "5.4.157"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "5.5"
            },
            {
                "fixed": "5.10.77"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "5.11"
            },
            {
                "fixed": "5.14.16"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.15-rc1"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.15-rc2"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.15-rc3"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.15-rc4"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.15-rc5"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.15-rc6"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "0"
            },
            {
                "last_affected": "5.15-rc7"
            }
        ]
    }
]