summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBasil Gello <vasek.gello@gmail.com>2017-07-13 19:29:21 +0300
committerChristopher N. Hesse <raymanfx@gmail.com>2017-07-17 22:15:16 +0000
commit72aac792160b74e07481ec6f72dfd61831f18e74 (patch)
treeec62abfbf0237a35624cc6fdd41bb90a21318307
parent338942b1883b439c285c5672a414c2b47d61f5ff (diff)
downloadandroid_hardware_samsung-72aac792160b74e07481ec6f72dfd61831f18e74.tar.gz
android_hardware_samsung-72aac792160b74e07481ec6f72dfd61831f18e74.tar.bz2
android_hardware_samsung-72aac792160b74e07481ec6f72dfd61831f18e74.zip
secril-client: Fix RIL client token management in SendOemRequestHookRaw()
On some devices, like SM-T805 (Galaxy Tab S 10.5 LTE), the RIL client code produces errors "SendOemRequestHookRaw: No token" due to large amount of tokens allocated by OEM messages requiring no response from RIL daemon (like set call audio path, set call volume, set mite etc). The indicator of an OEM message with no response expected is: RegisterRequestCompleteHandler(client, REQ_XXX, NULL); inside the RIL client message method. To prevent the token pool from overflows, the proposed patch de-registers the token and frees its call history if the handler for this message req_id is set to NULL. Change-Id: Id414263bf471115797cae1a9ed628249734b9347
-rwxr-xr-xril/libsecril-client/secril-client.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/ril/libsecril-client/secril-client.cpp b/ril/libsecril-client/secril-client.cpp
index d96f19b..a0bf078 100755
--- a/ril/libsecril-client/secril-client.cpp
+++ b/ril/libsecril-client/secril-client.cpp
@@ -1088,6 +1088,8 @@ static int SendOemRequestHookRaw(HRilClient client, int req_id, char *data, size
RilClientPrv *client_prv;
int maxfd = -1;
+ unsigned int check_req_id = req_id;
+
client_prv = (RilClientPrv *)(client->prv);
// Allocate a token.
@@ -1126,6 +1128,13 @@ static int SendOemRequestHookRaw(HRilClient client, int req_id, char *data, size
goto error;
}
+ // check if the handler for specified event is NULL and deregister token
+ // to prevent token pool overflow
+ if(!FindReqHandler(client_prv, token, &check_req_id)) {
+ FreeToken(&(client_prv->token_pool), token);
+ ClearReqHistory(client_prv, token);
+ }
+
return RIL_CLIENT_ERR_SUCCESS;
error: