drivers/amd/pm: fix a use-after-free in kv_parse_power_table
authorjsg <jsg@openbsd.org>
Mon, 29 Jan 2024 01:42:34 +0000 (01:42 +0000)
committerjsg <jsg@openbsd.org>
Mon, 29 Jan 2024 01:42:34 +0000 (01:42 +0000)
From Zhipeng Lu
95084632a65d5c0d682a83b55935560bdcd2a1e3 in linux-6.6.y/6.6.14
28dd788382c43b330480f57cd34cde0840896743 in mainline linux

sys/dev/pci/drm/amd/pm/legacy-dpm/amdgpu_kv_dpm.c

index 5d28c95..5cb4725 100644 (file)
@@ -2735,10 +2735,8 @@ static int kv_parse_power_table(struct amdgpu_device *adev)
                non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *)
                        &non_clock_info_array->nonClockInfo[non_clock_array_index];
                ps = kzalloc(sizeof(struct kv_ps), GFP_KERNEL);
-               if (ps == NULL) {
-                       kfree(adev->pm.dpm.ps);
+               if (ps == NULL)
                        return -ENOMEM;
-               }
                adev->pm.dpm.ps[i].ps_priv = ps;
                k = 0;
                idx = (u8 *)&power_state->v2.clockInfoIndex[0];