drm/amd/pm: fix double free in si_parse_power_table()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 841686df9f7d2942cfd94d024b8591fa3f74ef7c · < a5ce7051db044290b1a95045ff03c249005a3aa4| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
drm/amd/pm: fix double free in si_parse_power_table()
In function si_parse_power_table(), array adev->pm.dpm.ps and its member is allocated. If the allocation of each member fails, the array itself is freed and returned with an error code. However, the array is later freed again in si_dpm_fini() function which is called when the function returns an error.
This leads to potential double free of the array adev->pm.dpm.ps, as well as leak of its array members, since the members are not freed in the allocation function and the array is not nulled when freed. In addition adev->pm.dpm.num_ps, which keeps track of the allocated array member, is not updated until the member allocation is successfully finished, this could also lead to either use after free, or uninitialized variable access in si_dpm_fini().
Fix this by postponing the free of the array until si_dpm_fini() and increment adev->pm.dpm.num_ps everytime the array member is allocated.
From the CVE record · Linux
The Linux kernel's AMD power-management code can double-free an array if allocation of one of its members fails. The same error path can also leak memory or cause use-after-free or uninitialized-variable access. The input does not establish whether an attacker can trigger this condition or specify access or user-interaction requirements.
Engineers running the Linux kernel should check their installations; affected versions are not specified.