ASoC: samsung-i2s: Check secondary DAI exists before referencing
Subsystems (4)
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
@@ -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
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.
Signed-off-by Charles Keepax <[email protected]>
Thanks for the patch. We had one of those occurrences fixed internally but I missed to submit the patch upstream.
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.