Tom Rix
41855a8986
drm/radeon: fix double free
...
clang static analysis flags this error
drivers/gpu/drm/radeon/ci_dpm.c:5652:9: warning: Use of memory after it is freed [unix.Malloc]
kfree(rdev->pm.dpm.ps[i].ps_priv);
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/radeon/ci_dpm.c:5654:2: warning: Attempt to free released memory [unix.Malloc]
kfree(rdev->pm.dpm.ps);
^~~~~~~~~~~~~~~~~~~~~~
problem is reported in ci_dpm_fini, with these code blocks.
for (i = 0; i < rdev->pm.dpm.num_ps; i++) {
kfree(rdev->pm.dpm.ps[i].ps_priv);
}
kfree(rdev->pm.dpm.ps);
The first free happens in ci_parse_power_table where it cleans up locally
on a failure. ci_dpm_fini also does a cleanup.
ret = ci_parse_power_table(rdev);
if (ret) {
ci_dpm_fini(rdev);
return ret;
}
So remove the cleanup in ci_parse_power_table and
move the num_ps calculation to inside the loop so ci_dpm_fini
will know how many array elements to free.
Fixes: cc8dbbb4f6
("drm/radeon: add dpm support for CI dGPUs (v2)")
Signed-off-by: Tom Rix <trix@redhat.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
Cc: stable@vger.kernel.org
2020-07-09 14:42:49 -04:00
..
2020-03-25 11:50:48 +01:00
2020-04-30 16:48:42 -04:00
2019-12-05 08:44:28 +01:00
2020-02-17 10:34:34 +01:00
2020-01-07 12:04:13 -05:00
2020-01-07 12:04:13 -05:00
2019-12-18 16:09:13 -05:00
2019-12-05 08:44:28 +01:00
2019-06-10 22:30:24 +02:00
2020-07-09 14:42:49 -04:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2017-12-20 12:00:22 -05:00
2020-01-07 12:04:08 -05:00
2019-12-23 15:00:00 -05:00
2017-10-30 14:16:21 +01:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-12-05 08:44:28 +01:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-08-13 09:09:30 +02:00
2019-06-10 22:30:24 +02:00
2019-12-23 14:59:59 -05:00
2019-05-21 10:50:46 +02:00
2019-12-05 08:44:28 +01:00
2019-06-10 22:30:24 +02:00
2020-04-01 14:44:43 -04:00
2018-10-15 16:16:12 -05:00
2019-06-10 22:30:24 +02:00
2020-06-24 10:34:48 -04:00
2019-12-23 15:00:00 -05:00
2019-06-10 22:30:24 +02:00
2020-01-07 12:04:08 -05:00
2019-12-03 16:26:59 -05:00
2019-12-05 08:44:28 +01:00
2019-12-05 08:44:28 +01:00
2019-06-10 22:30:24 +02:00
2019-11-19 10:12:54 -05:00
2019-08-13 09:09:30 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2018-08-27 11:10:19 -05:00
2020-01-07 12:04:08 -05:00
2019-06-10 22:30:24 +02:00
2017-08-15 14:46:07 -04:00
2019-12-05 08:44:28 +01:00
2019-12-05 08:44:28 +01:00
2019-08-13 09:09:30 +02:00
2020-03-28 22:48:20 +01:00
2019-05-30 11:29:21 -07:00
2019-11-26 14:51:04 -05:00
2019-08-13 09:09:30 +02:00
2020-03-30 09:52:23 -05:00
2019-12-05 08:44:28 +01:00
2020-03-28 22:48:20 +01:00
2020-01-07 12:04:13 -05:00
2020-06-09 09:39:14 -07:00
2019-06-10 22:30:24 +02:00
2020-01-24 17:41:34 +00:00
2020-02-17 10:34:34 +01:00
2019-06-10 22:30:24 +02:00
2020-03-11 16:53:17 -04:00
2020-04-03 17:11:41 +02:00
2019-04-24 12:32:14 +10:00
2019-12-05 08:44:28 +01:00
2020-03-06 14:19:58 +01:00
2019-06-10 22:30:24 +02:00
2019-12-05 08:44:28 +01:00
2020-06-09 09:39:14 -07:00
2019-12-05 08:44:28 +01:00
2019-06-10 22:30:24 +02:00
2019-12-05 08:44:28 +01:00
2020-06-02 15:04:15 -07:00
2020-02-13 13:08:14 +01:00
2020-01-07 12:04:08 -05:00
2019-11-19 10:12:54 -05:00
2019-11-23 19:56:44 -04:00
2020-03-06 14:19:57 +01:00
2019-10-25 11:40:50 +02:00
2019-08-13 09:09:30 +02:00
2020-01-07 12:04:08 -05:00
2019-08-13 09:09:30 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-08-13 09:09:30 +02:00
2019-08-06 08:21:54 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2020-03-31 15:15:47 +10:00
2019-06-10 22:30:24 +02:00
2019-08-13 09:09:30 +02:00
2020-01-07 12:04:13 -05:00
2020-01-07 12:04:13 -05:00
2019-11-23 19:56:44 -04:00
2019-06-10 22:30:24 +02:00
2019-12-05 08:44:28 +01:00
2019-12-05 08:44:28 +01:00
2019-12-05 08:44:28 +01:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-08-13 09:09:30 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-12-23 14:59:59 -05:00
2019-08-13 09:09:30 +02:00
2020-04-13 12:02:45 -04:00
2019-06-10 22:30:24 +02:00
2019-12-23 14:59:58 -05:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-12-05 08:44:28 +01:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00
2019-06-10 22:30:24 +02:00