drm/radeon/trinity_dpm: fix a memleak in trinity_parse_power_table
authorjsg <jsg@openbsd.org>
Mon, 29 Jan 2024 01:37:52 +0000 (01:37 +0000)
committerjsg <jsg@openbsd.org>
Mon, 29 Jan 2024 01:37:52 +0000 (01:37 +0000)
From Zhipeng Lu
0564e8a427914015d773a32f6e9baa2bd2f38a37 in linux-6.6.y/6.6.14
28c28d7f77c06ac2c0b8f9c82bc04eba22912b3b in mainline linux

sys/dev/pci/drm/radeon/trinity_dpm.c

index 08ea1c8..ef1cc7b 100644 (file)
@@ -1726,8 +1726,10 @@ static int trinity_parse_power_table(struct radeon_device *rdev)
                non_clock_array_index = power_state->v2.nonClockInfoIndex;
                non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *)
                        &non_clock_info_array->nonClockInfo[non_clock_array_index];
-               if (!rdev->pm.power_state[i].clock_info)
+               if (!rdev->pm.power_state[i].clock_info) {
+                       kfree(rdev->pm.dpm.ps);
                        return -EINVAL;
+               }
                ps = kzalloc(sizeof(struct sumo_ps), GFP_KERNEL);
                if (ps == NULL) {
                        kfree(rdev->pm.dpm.ps);