2017-11-07 17:32:46 -05:00
|
|
|
From 05f4374845738d2146075e77d9139e60a558de18 Mon Sep 17 00:00:00 2001
|
2017-10-29 01:48:53 -04:00
|
|
|
From: Walter Yang <yandongy@codeaurora.org>
|
|
|
|
Date: Thu, 2 Mar 2017 12:13:34 +0800
|
|
|
|
Subject: ASoC: Add backend user count checking
|
|
|
|
|
|
|
|
Add backend user count checking to protect the index
|
|
|
|
boundary.
|
|
|
|
|
|
|
|
Change-Id: Ic1b61d1f7130252cc54da0b16553858714988dbd
|
|
|
|
CRs-Fixed: 2009216
|
|
|
|
Signed-off-by: Walter Yang <yandongy@codeaurora.org>
|
|
|
|
---
|
|
|
|
sound/soc/soc-compress.c | 5 +++++
|
|
|
|
sound/soc/soc-pcm.c | 4 ++++
|
|
|
|
2 files changed, 9 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
|
2017-11-07 17:32:46 -05:00
|
|
|
index eb894d0..736b9c4 100644
|
2017-10-29 01:48:53 -04:00
|
|
|
--- a/sound/soc/soc-compress.c
|
|
|
|
+++ b/sound/soc/soc-compress.c
|
2017-11-07 17:32:46 -05:00
|
|
|
@@ -527,6 +527,11 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
|
2017-10-29 01:48:53 -04:00
|
|
|
cstream, &async_domain);
|
|
|
|
} else {
|
|
|
|
be_list[j++] = be;
|
|
|
|
+ if (j == DPCM_MAX_BE_USERS) {
|
|
|
|
+ dev_dbg(fe->dev,
|
|
|
|
+ "ASoC: MAX backend users!\n");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < j; i++) {
|
|
|
|
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
|
2017-11-07 17:32:46 -05:00
|
|
|
index 13649f9..0ba9dfb 100644
|
2017-10-29 01:48:53 -04:00
|
|
|
--- a/sound/soc/soc-pcm.c
|
|
|
|
+++ b/sound/soc/soc-pcm.c
|
2017-11-07 17:32:46 -05:00
|
|
|
@@ -2403,6 +2403,10 @@ void dpcm_be_dai_prepare_async(struct snd_soc_pcm_runtime *fe, int stream,
|
2017-10-29 01:48:53 -04:00
|
|
|
dpcm, domain);
|
|
|
|
} else {
|
|
|
|
dpcm_async[i++] = dpcm;
|
|
|
|
+ if (i == DPCM_MAX_BE_USERS) {
|
|
|
|
+ dev_dbg(fe->dev, "ASoC: MAX backend users!\n");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
|
|
|
cgit v1.1
|
|
|
|
|