All of lore.kernel.org
 help / color / mirror / Atom feed
From: mnlife <178316538@qq.com>
To: lgirdwood <lgirdwood@gmail.com>, Jaroslav Kysela <perex@perex.cz>,
	open list <linux-kernel@vger.kernel.org>,
	mnlife qiao <mnlife@foxmail.com>,
	alsa-devel <alsa-devel@alsa-project.org>
Cc: "nmlife.qiao@gmail.com" <nmlife.qiao@gmail.com>,
	mnlife qiao <mnlife@foxmail.com>
Subject: [PATCH] ASoC: soc-jack: calling snd_soc_jack_report causes a null pointer access
Date: Sat, 18 Jul 2020 22:56:01 +0800	[thread overview]
Message-ID: <20200718145743.09573F8016F@alsa1.perex.cz> (raw)

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

From: mnlife <mnlife@foxmail.com> 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 <mnlife@foxmail.com> --- 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 .

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ASoC-soc-jack-calling-snd_soc_jack_report-causes-a-n.patch --]
[-- Type: text/x-diff; name="0001-ASoC-soc-jack-calling-snd_soc_jack_report-causes-a-n.patch", Size: 912 bytes --]

From 1cd6ed8cd1c8518d6bd30bdc0b1cf998a3abe32d Mon Sep 17 00:00:00 2001
From: mnlife <mnlife@foxmail.com>
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

Signed-off-by: mnlife <mnlife@foxmail.com>
---
 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


             reply	other threads:[~2020-07-20  7:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-18 14:56 mnlife [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-08-11 14:25 [PATCH] ASoC: soc-jack: calling snd_soc_jack_report causes a null pointer access mnlife
2023-08-15 18:09 ` Mark Brown
2020-07-19  3:08 mnlife qiao
     [not found] <tencent_2D17145034BA02B43C169473C02C4257AF06@qq.com>
2020-07-19  2:52 ` mnlife qiao
     [not found] <5f0e49da.1c69fb81.1ede7.a8fbSMTPIN_ADDED_MISSING@mx.google.com>
2020-07-15  0:24 ` mnlife qiao
2020-07-16 22:29   ` Mark Brown
2020-07-16 22:29     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200718145743.09573F8016F@alsa1.perex.cz \
    --to=178316538@qq.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mnlife@foxmail.com \
    --cc=nmlife.qiao@gmail.com \
    --cc=perex@perex.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.