summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeena Winterrowd <lenhardw@codeaurora.org>2016-01-12 15:05:53 -0800
committerArne Coucheron <arco68@gmail.com>2019-09-28 00:23:56 +0200
commitb6fb408257fd2501c917e4b3048afccc87a28349 (patch)
tree0def3601f6817f614b1ce36ce8ca2dafc7098c15
parent041282b9e94eae27bb5db0e990be2d8069aecb0a (diff)
downloadhardware_qcom_audio-b6fb408257fd2501c917e4b3048afccc87a28349.tar.gz
hardware_qcom_audio-b6fb408257fd2501c917e4b3048afccc87a28349.tar.bz2
hardware_qcom_audio-b6fb408257fd2501c917e4b3048afccc87a28349.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 d8491b93..815e42ed 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) {