volume listener: check for correct effect descriptor when releasing
It is possible that the effect descriptor in the listener
context is NULL. Attempting to access its fields would result
in a SIGSEGV. Add a check to avoid crashing.
Bug: 63780779
Test: HAL should not be crashing in vol_prc_lib_release
Change-Id: I241890840acab56e0c706ffca542fa2b1ffef02a
diff --git a/post_proc/volume_listener.c b/post_proc/volume_listener.c
index 54226b7..d4aa79f 100644
--- a/post_proc/volume_listener.c
+++ b/post_proc/volume_listener.c
@@ -766,6 +766,16 @@
pthread_mutex_lock(&vol_listner_init_lock);
session_id = recv_contex->session_id;
stream_type = recv_contex->stream_type;
+
+ if (recv_contex->desc == NULL) {
+ ALOGE("%s: Got NULL descriptor, session %u, stream type %u",
+ __func__, session_id, stream_type);
+ if (dumping_enabled) {
+ dump_list_l();
+ }
+ pthread_mutex_unlock(&vol_listner_init_lock);
+ return status;
+ }
uuid = recv_contex->desc->uuid;
// check if the handle/context provided is valid