Skip to contentSkip to conversation

ASoC: samsung-i2s: Check secondary DAI exists before referencing

PATCH Applied Charles Keepax 3 participants 3 messages Sep 9, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: samsung-i2s: Check secondary DAI exists before referencing

In a couple of places the driver is missing a check to ensure there is a secondary DAI before it de-references the pointer to it, causing a null pointer de-reference. This patch adds a check to avoid this.

---
 sound/soc/samsung/i2s.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
sound/soc/samsung/i2s.c +3 -2
index 03eec22..9d51347 100644
@@ -462,7 +462,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
 		if (dir == SND_SOC_CLOCK_IN)
 			rfs = 0;
 
-		if ((rfs && other->rfs && (other->rfs != rfs)) ||
+		if ((rfs && other && other->rfs && (other->rfs != rfs)) ||
 				(any_active(i2s) &&
 				(((dir == SND_SOC_CLOCK_IN)
 					&& !(mod & MOD_CDCLKCON)) ||
@@ -762,7 +762,8 @@ static void i2s_shutdown(struct snd_pcm_substream *substream,
 	} else {
 		u32 mod = readl(i2s->addr + I2SMOD);
 		i2s->cdclk_out = !(mod & MOD_CDCLKCON);
-		other->cdclk_out = i2s->cdclk_out;
+		if (other)
+			other->cdclk_out = i2s->cdclk_out;
 	}
 	/* Reset any constraint on RFS and BFS */
 	i2s->rfs = 0;
Signature · 1 line
1.7.2.5
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Charles Keepax

In a couple of places the driver is missing a check to ensure there is a secondary DAI before it de-references the pointer to it, causing a null pointer de-reference. This patch adds a check to avoid this.

Thanks for the patch. We had one of those occurrences fixed internally but I missed to submit the patch upstream.

maintainer Applied
#2 lore raw
In reply to Charles Keepax
Quoted 3 lines · Charles Keepax

In a couple of places the driver is missing a check to ensure there is a secondary DAI before it de-references the pointer to it, causing a null pointer de-reference. This patch adds a check to avoid this.

Applied, thanks.