All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: samsung-i2s: Check secondary DAI exists before referencing
@ 2014-09-09 15:51 Charles Keepax
  2014-09-09 17:08 ` Sylwester Nawrocki
  2014-09-09 17:09 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Charles Keepax @ 2014-09-09 15:51 UTC (permalink / raw)
  To: broonie; +Cc: sbkim73, alsa-devel, linux-samsung-soc, lgirdwood, patches

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 <ckeepax@opensource.wolfsonmicro.com>
---
 sound/soc/samsung/i2s.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 03eec22..9d51347 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -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;
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: samsung-i2s: Check secondary DAI exists before referencing
  2014-09-09 15:51 [PATCH] ASoC: samsung-i2s: Check secondary DAI exists before referencing Charles Keepax
@ 2014-09-09 17:08 ` Sylwester Nawrocki
  2014-09-09 17:09 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Sylwester Nawrocki @ 2014-09-09 17:08 UTC (permalink / raw)
  To: Charles Keepax, broonie
  Cc: sbkim73, lgirdwood, linux-samsung-soc, alsa-devel, patches

On 09/09/14 17:51, Charles Keepax wrote:
> 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 <ckeepax@opensource.wolfsonmicro.com>

Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: samsung-i2s: Check secondary DAI exists before referencing
  2014-09-09 15:51 [PATCH] ASoC: samsung-i2s: Check secondary DAI exists before referencing Charles Keepax
  2014-09-09 17:08 ` Sylwester Nawrocki
@ 2014-09-09 17:09 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-09-09 17:09 UTC (permalink / raw)
  To: Charles Keepax; +Cc: sbkim73, lgirdwood, linux-samsung-soc, alsa-devel, patches

[-- Attachment #1: Type: text/plain, Size: 294 bytes --]

On Tue, Sep 09, 2014 at 04:51:49PM +0100, Charles Keepax wrote:
> 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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-09 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-09 15:51 [PATCH] ASoC: samsung-i2s: Check secondary DAI exists before referencing Charles Keepax
2014-09-09 17:08 ` Sylwester Nawrocki
2014-09-09 17:09 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.