From d4c151d76e8b5e48232c0cd19b38e33f81274aeb Mon Sep 17 00:00:00 2001 From: Prasad Kumpatla Date: Wed, 4 Dec 2019 13:39:40 +0530 Subject: [PATCH] dsp: codecs: fix error check for q6audio aio Fix error check for q6audio audio pointer to avoid Null pointer dereference. Change-Id: Icf30cf2f670c07f3118132e378fa43256ddec530 Signed-off-by: Prasad Kumpatla --- dsp/codecs/q6audio_v2_aio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dsp/codecs/q6audio_v2_aio.c b/dsp/codecs/q6audio_v2_aio.c index 4cb46365b12c..a6f7836d8134 100644 --- a/dsp/codecs/q6audio_v2_aio.c +++ b/dsp/codecs/q6audio_v2_aio.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. */ #include @@ -43,6 +43,10 @@ void audio_aio_cb(uint32_t opcode, uint32_t token, struct q6audio_aio *audio = (struct q6audio_aio *)priv; union msm_audio_event_payload e_payload; + if (audio == NULL) { + pr_err("%s: failed to get q6audio value\n", __func__); + return; + } switch (opcode) { case ASM_DATA_EVENT_WRITE_DONE_V2: pr_debug("%s[%pK]:ASM_DATA_EVENT_WRITE_DONE token = 0x%x\n",