In the Linux kernel, the following vulnerability has been resolved:
drm/amd/pm: fix double free in siparsepower_table()
In function siparsepowertable(), 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 sidpm_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.numps, 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 sidpm_fini().
Fix this by postponing the free of the array until sidpmfini() and increment adev->pm.dpm.num_ps everytime the array member is allocated.