mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
msm: ipa: add check to see if pm client is not NULL
Add check to see if it is freed in pm deregister context and trying to read again after free. Change-Id: I764f012d0c7cd53f126aee221f7c1d6a914b7390 Signed-off-by: Michael Adisumarta <madisuma@codeaurora.org>
This commit is contained in:
parent
82e754aa5b
commit
fb711db3c7
1 changed files with 9 additions and 6 deletions
|
|
@ -1266,14 +1266,15 @@ int ipa_pm_set_throughput(u32 hdl, int throughput)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&ipa_pm_ctx->client_mutex);
|
||||
if (hdl >= IPA_PM_MAX_CLIENTS || ipa_pm_ctx->clients[hdl] == NULL
|
||||
|| throughput < 0) {
|
||||
IPA_PM_ERR("Invalid Params\n");
|
||||
mutex_unlock(&ipa_pm_ctx->client_mutex);
|
||||
return -EINVAL;
|
||||
}
|
||||
client = ipa_pm_ctx->clients[hdl];
|
||||
|
||||
mutex_lock(&ipa_pm_ctx->client_mutex);
|
||||
if (client->group == IPA_PM_GROUP_DEFAULT)
|
||||
IPA_PM_DBG_LOW("Old throughput: %d\n", client->throughput);
|
||||
else
|
||||
|
|
@ -1292,14 +1293,16 @@ int ipa_pm_set_throughput(u32 hdl, int throughput)
|
|||
client->group, ipa_pm_ctx->group_tput[client->group]);
|
||||
mutex_unlock(&ipa_pm_ctx->client_mutex);
|
||||
|
||||
spin_lock_irqsave(&client->state_lock, flags);
|
||||
if (IPA_PM_STATE_ACTIVE(client->state) || (client->group !=
|
||||
if (ipa_pm_ctx->clients[hdl]) {
|
||||
spin_lock_irqsave(&client->state_lock, flags);
|
||||
if (IPA_PM_STATE_ACTIVE(client->state) || (client->group !=
|
||||
IPA_PM_GROUP_DEFAULT)) {
|
||||
spin_unlock_irqrestore(&client->state_lock, flags);
|
||||
do_clk_scaling();
|
||||
return 0;
|
||||
}
|
||||
spin_unlock_irqrestore(&client->state_lock, flags);
|
||||
do_clk_scaling();
|
||||
return 0;
|
||||
}
|
||||
spin_unlock_irqrestore(&client->state_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue