summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeena Winterrowd <lenhardw@codeaurora.org>2016-01-12 15:05:53 -0800
committerArne Coucheron <arco68@gmail.com>2016-05-11 00:12:22 +0200
commit09948fc8c8b267244e0f7086ed7e3016eedc62b6 (patch)
treee5616302bf5a749145292fe2727f94aff344ce47
parent51f015be7c9a1d309d02750530bf8a19e9617581 (diff)
downloadhardware_qcom_audio-09948fc8c8b267244e0f7086ed7e3016eedc62b6.tar.gz
hardware_qcom_audio-09948fc8c8b267244e0f7086ed7e3016eedc62b6.tar.bz2
hardware_qcom_audio-09948fc8c8b267244e0f7086ed7e3016eedc62b6.zip
hal: Validate active input before accessing source
Ensure that the audio device's active input is valid before attempting to access the input source. CRs-Fixed: 959009 Change-Id: If66cc1e3d5467bf7d03137fdbbffd724a57ecaf6
-rw-r--r--hal/audio_hw.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 589f16a4..308d3e27 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -746,7 +746,8 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
out_snd_device = SND_DEVICE_NONE;
if (in_snd_device == SND_DEVICE_NONE) {
audio_devices_t out_device = AUDIO_DEVICE_NONE;
- if ((adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION || (adev->mode == AUDIO_MODE_IN_COMMUNICATION && adev->active_input->source == AUDIO_SOURCE_MIC)) &&
+ if ((adev->active_input &&
+ (adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION || (adev->mode == AUDIO_MODE_IN_COMMUNICATION && adev->active_input->source == AUDIO_SOURCE_MIC))) &&
adev->primary_output && !adev->primary_output->standby) {
out_device = adev->primary_output->devices;
} else if(usecase->id == USECASE_AUDIO_RECORD_AFE_PROXY) {