libril: Protect against NULL unsolicited response function

Upstream change I732234a22328a1bfcb603bb020547f543b6fd766 makes
RIL_UNSOL_DC_RT_INFO_CHANGED's responseFunction() NULL, without
protecting against it in RIL_onUnsolicitedResponse(), thus crash-
ing at least hammerhead's RIL stack upon mobile data connection.

https://android-review.googlesource.com/#/c/platform/hardware/ril/+/345950/

Change-Id: I6567019cb6daf6492a29e04cc9872e69b2ba456d
Signed-off-by: D. Andrei Măceș <Andrei.Maces@alumni.nd.edu>
(cherry picked from commit e73eafff8695ab28201acbc03a362d5b177047aa)
This commit is contained in:
D. Andrei Măceș 2017-10-07 18:07:00 +03:00 committed by Kevin F. Haggerty
parent d3810f950a
commit 289c1006ef

View File

@ -782,9 +782,11 @@ void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
int rwlockRet = pthread_rwlock_rdlock(radioServiceRwlockPtr); int rwlockRet = pthread_rwlock_rdlock(radioServiceRwlockPtr);
assert(rwlockRet == 0); assert(rwlockRet == 0);
if (s_unsolResponses[unsolResponseIndex].responseFunction) {
ret = s_unsolResponses[unsolResponseIndex].responseFunction( ret = s_unsolResponses[unsolResponseIndex].responseFunction(
(int) soc_id, responseType, 0, RIL_E_SUCCESS, const_cast<void*>(data), (int) soc_id, responseType, 0, RIL_E_SUCCESS, const_cast<void*>(data),
datalen); datalen);
}
rwlockRet = pthread_rwlock_unlock(radioServiceRwlockPtr); rwlockRet = pthread_rwlock_unlock(radioServiceRwlockPtr);
assert(rwlockRet == 0); assert(rwlockRet == 0);