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
..
2014-02-06 12:13:52 +10:00
2020-03-25 11:50:48 +01:00
2009-06-15 12:01:53 +10:00
2009-06-15 12:01:53 +10: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
2017-02-27 18:43:46 -08:00
2010-02-23 09:46:21 +10:00
2019-12-05 08:44:28 +01:00
2019-06-10 22:30:24 +02:00
2014-02-06 12:22:46 -05: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
2013-06-27 10:49:18 -04:00
2013-08-30 16:30:08 -04:00
2019-06-10 22:30:24 +02:00
2019-12-05 08:44:28 +01:00
2013-06-27 19:16:19 -04: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
2016-04-27 12:27:08 -04:00
2014-03-06 16:46:58 -05:00
2019-12-23 14:59:59 -05:00
2016-08-24 16:25:05 -04:00
2019-05-21 10:50:46 +02:00
2019-12-05 08:44:28 +01:00
2013-09-11 11:44:38 -04: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
2013-07-08 17:41:11 -04:00
2019-12-23 15:00:00 -05:00
2016-08-24 16:25:05 -04:00
2013-06-27 19:16:10 -04:00
2013-06-26 16:11:34 -04:00
2014-11-20 13:00:10 -05:00
2014-11-20 13:00:10 -05:00
2019-06-10 22:30:24 +02:00
2020-01-07 12:04:08 -05:00
2013-01-31 16:24:46 -05:00
2019-12-03 16:26:59 -05:00
2019-12-05 08:44:28 +01:00
2013-01-31 16:24:46 -05:00
2019-12-05 08:44:28 +01:00
2009-10-02 08:51:46 +10:00
2019-06-10 22:30:24 +02:00
2009-09-29 11:15:56 +10: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
2016-08-24 16:25:04 -04: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
2016-01-27 12:48:32 -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
2014-08-05 08:53:22 -04: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
2009-10-02 08:51:49 +10:00
2019-06-10 22:30:24 +02:00
2009-10-02 08:51:46 +10:00
2019-12-05 08:44:28 +01:00
2012-04-24 09:50:13 +01:00
2019-12-05 08:44:28 +01:00
2013-04-09 10:31:31 -04:00
2019-12-05 08:44:28 +01:00
2013-06-27 10:49:25 -04:00
2013-07-17 16:47:52 -04:00
2019-06-10 22:30:24 +02:00
2013-06-27 10:50:08 -04:00
2013-06-27 10:50:08 -04:00
2009-10-02 08:51:49 +10:00
2009-10-02 08:51:49 +10:00
2009-10-02 08:51:46 +10:00
2019-06-10 22:30:24 +02:00
2013-01-31 16:24:46 -05:00
2019-06-10 22:30:24 +02:00
2013-06-27 19:14:59 -04:00
2019-06-10 22:30:24 +02:00
2013-06-27 19:14:59 -04: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
2013-09-11 11:44:28 -04:00
2019-12-23 14:59:59 -05:00
2016-08-24 16:25:05 -04:00
2019-08-13 09:09:30 +02:00
2020-04-13 12:02:45 -04:00
2015-01-22 10:38:48 -05:00
2012-06-20 19:55:56 +01:00
2019-06-10 22:30:24 +02:00
2019-12-23 14:59:58 -05:00
2016-10-12 15:44:15 -04:00
2014-11-20 13:00:10 -05:00
2013-08-30 16:30:28 -04:00
2013-08-30 16:30:28 -04: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
2013-06-27 19:15:48 -04:00
2019-12-05 08:44:28 +01:00
2013-09-11 11:44:39 -04:00
2019-06-10 22:30:24 +02:00
2013-06-27 19:15:48 -04: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