summaryrefslogtreecommitdiff
path: root/drivers/devfreq
diff options
context:
space:
mode:
authorDan Sneddon <dsneddon@codeaurora.org>2014-10-24 09:20:46 -0600
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:04:01 -0700
commit8f76ceeddbfc7ad97946e2fb065cde97689b7e80 (patch)
treecab66a33a93da9eaf94ae55b1fb3ed524b25e037 /drivers/devfreq
parent9f5c0d45f485f581332075352c32f5fae334a570 (diff)
devfreq: spdm: Fix bad pointer access
If the spdm governor fails to connect to the hypervisor correctly the device it is supposed to be governing will be freed but still stored in the local list. This patch removes the device from the list to prevent accessing an invalid pointer if the hypervisor returns an error. Change-Id: I536c198b5a25adbd3044ffd37d9951c197b1dfd9 Signed-off-by: Dan Sneddon <dsneddon@codeaurora.org>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r--drivers/devfreq/governor_spdm_bw_hyp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/devfreq/governor_spdm_bw_hyp.c b/drivers/devfreq/governor_spdm_bw_hyp.c
index 8b85dd042d1f..0dfe8ecee09e 100644
--- a/drivers/devfreq/governor_spdm_bw_hyp.c
+++ b/drivers/devfreq/governor_spdm_bw_hyp.c
@@ -286,6 +286,14 @@ static int gov_spdm_hyp_eh(struct devfreq *devfreq, unsigned int event,
if (hvc_status) {
pr_err("HVC command %u failed with error %u",
(int)desc.arg[0], hvc_status);
+ mutex_lock(&devfreqs_lock);
+ /*
+ * the spdm device probe will fail so remove it from
+ * the list to prevent accessing a deleted pointer in
+ * the future
+ * */
+ list_del(&spdm_data->list);
+ mutex_unlock(&devfreqs_lock);
return -EINVAL;
}
devfreq_monitor_start(devfreq);