mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
48 lines
1.4 KiB
Diff
48 lines
1.4 KiB
Diff
From 338a5cecf0f839331f0a58bff8aaae79e134799e Mon Sep 17 00:00:00 2001
|
|
From: Fred Oh <fred@codeaurora.org>
|
|
Date: Tue, 07 Apr 2015 19:22:29 -0700
|
|
Subject: [PATCH] ASoC: msm: qdsp6v2: validate audio client in callback
|
|
|
|
In case of single stream multiple device(SSMD) use-case audio session is
|
|
freed on first EOS. There are some chance to crash when 2nd EOS event is
|
|
reached with some delay. This make sure return properly if audio client
|
|
is not valid.
|
|
|
|
Bug: 36252027
|
|
Change-Id: I3711d8e039fc37e654ca5230f3dc8784c6dba071
|
|
Signed-off-by: Fred Oh <fred@codeaurora.org>
|
|
Signed-off-by: Siqi Lin <siqilin@google.com>
|
|
---
|
|
|
|
diff --git a/sound/soc/msm/qdsp6v2/q6asm.c b/sound/soc/msm/qdsp6v2/q6asm.c
|
|
index b17a440..4f486b1 100644
|
|
--- a/sound/soc/msm/qdsp6v2/q6asm.c
|
|
+++ b/sound/soc/msm/qdsp6v2/q6asm.c
|
|
@@ -329,6 +329,16 @@
|
|
return -ENOMEM;
|
|
}
|
|
|
|
+static bool q6asm_is_valid_audio_client(struct audio_client *ac)
|
|
+{
|
|
+ int n;
|
|
+ for (n = 1; n <= SESSION_MAX; n++) {
|
|
+ if (session[n] == ac)
|
|
+ return 1;
|
|
+ }
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static void q6asm_session_free(struct audio_client *ac)
|
|
{
|
|
pr_debug("%s: sessionid[%d]\n", __func__, ac->session);
|
|
@@ -905,7 +915,8 @@
|
|
pr_err("ac or priv NULL\n");
|
|
return -EINVAL;
|
|
}
|
|
- if (ac->session <= 0 || ac->session > 8) {
|
|
+ if (ac->session <= 0 || ac->session > 8 ||
|
|
+ !q6asm_is_valid_audio_client(ac)) {
|
|
pr_err("%s:Session ID is invalid, session = %d\n", __func__,
|
|
ac->session);
|
|
return -EINVAL;
|