Skip to contentSkip to conversation

ASoC: soc-jack: calling snd_soc_jack_report causes a null pointer access

PATCH New mnlife 1 participant 1 message Jul 20, 2020

Subsystems (2)
lore
Share & tools
lore

mnlife

author
#0 lore raw

PATCH 1/1 ASoC: soc-jack: calling snd_soc_jack_report causes a null pointer access

From: mnlife <[email protected]> When snd_soc_card_jack_new is not called or the call fails, calling this function causes a null pointer access Signed-off-by: mnlife <[email protected]> --- sound/soc/soc-jack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c index 0f1820f36b4d..51b799ee98b7 100644 --- a/sound/soc/soc-jack.c +++ b/sound/soc/soc-jack.c @@ -44,7 +44,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)      unsigned int sync = 0;      int enable; -     if (!jack) +     if (!jack || !jack->jack)           return;      trace_snd_soc_jack_report(jack, mask, status); -- 2.17.1 .

From 1cd6ed8cd1c8518d6bd30bdc0b1cf998a3abe32d Mon Sep 17 00:00:00 2001
From: mnlife <[email protected]>
Date: Fri, 10 Jul 2020 21:31:08 +0800
Subject: [PATCH] ASoC: soc-jack: calling snd_soc_jack_report causes a null
pointer access
Content-Type: text/plain; charset="utf-8"

When snd_soc_card_jack_new is not called or the call fails, calling this function causes a null pointer access

---
 sound/soc/soc-jack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-jack.c +1 -1
index 0f1820f36b4d..51b799ee98b7 100644
@@ -44,7 +44,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
 	unsigned int sync = 0;
 	int enable;
 
-	if (!jack)
+	if (!jack || !jack->jack)
 		return;
 	trace_snd_soc_jack_report(jack, mask, status);
 
Signature · 1 line
2.17.1