Skip to contentSkip to conversation

NULL pointer dereference in codec probe

for-next Jani Nikula 3 participants 6 messages Apr 30, 2015 Sound

lore
Share & tools
lore
#0 lore raw

Hi all, our graphics QA found an issue [1] with the for-next branch of
[2] merged on top of v4.1-rc1. Backtrace in the bug. I didn't really have time to look into the details, but just letting you know.

BR,
Jani.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=90229
[2] git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#1 lore raw

At Thu, 30 Apr 2015 13:06:41 +0300,

Quoted 5 lines · Jani Nikula

Hi all, our graphics QA found an issue [1] with the for-next branch of
[2] merged on top of v4.1-rc1. Backtrace in the bug. I didn't really have time to look into the details, but just letting you know.

Looks like the new jack stuff broke something. Keyon, could you take a look?

thanks,

Takashi

Quoted 12 lines

BR,
Jani.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=90229
[2] git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#2 lore raw
Quoted 11 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, April 30, 2015 6:23 PM
To: Nikula, Jani
Cc: Jaroslav Kysela; [email protected]; Tian, YeX; Jie, Yang
Subject: Re: [for-next] NULL pointer dereference in codec probe

At Thu, 30 Apr 2015 13:06:41 +0300,

Quoted 2 lines · Jani Nikula
Quoted 5 lines
Quoted 3 lines

Hi all, our graphics QA found an issue [1] with the for-next branch of
[2] merged on top of v4.1-rc1. Backtrace in the bug. I didn't really have time to look into the details, but just letting you know.

Looks like the new jack stuff broke something. Keyon, could you take a look?

I noticed this today and root caused it. Will provide a patch for it tomorrow.

~Keyon

Quoted 19 lines

thanks,

Takashi

Quoted 12 lines

BR,
Jani.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=90229
[2] git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git

--
Jani Nikula, Intel Open Source Technology Center

#3 lore raw
In reply to Takashi Iwai
Quoted 18 lines

-----Original Message-----
From: Jie, Yang
Sent: Thursday, April 30, 2015 7:08 PM
To: 'Takashi Iwai'; Nikula, Jani
Cc: Jaroslav Kysela; [email protected]; Tian, YeX
Subject: RE: [for-next] NULL pointer dereference in codec probe

Quoted 11 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, April 30, 2015 6:23 PM
To: Nikula, Jani
Cc: Jaroslav Kysela; [email protected]; Tian, YeX; Jie, Yang
Subject: Re: [for-next] NULL pointer dereference in codec probe

At Thu, 30 Apr 2015 13:06:41 +0300,

Quoted 2 lines · Jani Nikula
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Hi all, our graphics QA found an issue [1] with the for-next branch of [2] merged on top of v4.1-rc1. Backtrace in the bug. I didn't really have time to look into the details, but just letting you know.

Looks like the new jack stuff broke something. Keyon, could you take a

look?

I noticed this today and root caused it. Will provide a patch for it tomorrow.

I just worked out a patch[1] to fix it. no chance to test it yet. will send it to ML once it passed my testing tomorrow.

[1] https://bugs.freedesktop.org/attachment.cgi?id=115474

~Keyon

Quoted 22 lines

~Keyon

Quoted 19 lines

thanks,

Takashi

Quoted 12 lines

BR,
Jani.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=90229
[2] git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git

--
Jani Nikula, Intel Open Source Technology Center

#4 lore raw

At Thu, 30 Apr 2015 12:27:52 +0000,

Quoted 24 lines · Yang
Quoted 24 lines

-----Original Message-----
From: Jie, Yang
Sent: Thursday, April 30, 2015 7:08 PM
To: 'Takashi Iwai'; Nikula, Jani
Cc: Jaroslav Kysela; [email protected]; Tian, YeX
Subject: RE: [for-next] NULL pointer dereference in codec probe

Quoted 16 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, April 30, 2015 6:23 PM
To: Nikula, Jani
Cc: Jaroslav Kysela; [email protected]; Tian, YeX; Jie, Yang
Subject: Re: [for-next] NULL pointer dereference in codec probe

At Thu, 30 Apr 2015 13:06:41 +0300,

Quoted 5 lines · Jani Nikula

Hi all, our graphics QA found an issue [1] with the for-next branch of [2] merged on top of v4.1-rc1. Backtrace in the bug. I didn't really have time to look into the details, but just letting you know.

Looks like the new jack stuff broke something. Keyon, could you take a

Quoted 8 lines
Quoted 3 lines

look?

I noticed this today and root caused it. Will provide a patch for it tomorrow.

I just worked out a patch[1] to fix it. no chance to test it yet. will send it to ML once it passed my testing tomorrow.

[1] https://bugs.freedesktop.org/attachment.cgi?id=115474

I could reproduce the problem on my machine, and checked your patch. It's good per se, but it doesn't suffice. We have to cover all jack->input_dev accesses. The additional fix patch is attached below.

Since the bug is fixed by these patches, I'm going to queue them to topic/jack and for-next branch.

thanks,

Takashi

-- 8< --
From: Takashi Iwai <[email protected]>
Subject: [PATCH] ALSA: jack: Fix another NULL dereference due to empty input
jack

Another fixes for NULL jack->input_dev in some places in jack.c.

Fixes 2ba2dfa1fcc7 ('ALSA: hda - Update to use the new jack kctls method')
---
 sound/core/jack.c | 6 ++++++
 1 file changed, 6 insertions(+)
sound/core/jack.c +6 -0
index 0dbd618e3c94..eb66327b5f1c 100644
@@ -87,6 +87,10 @@ static int snd_jack_dev_register(struct snd_device *device)
 
 	snprintf(jack->name, sizeof(jack->name), "%s %s",
 		 card->shortname, jack->id);
+
+	if (!jack->input_dev)
+		return 0;
+
 	jack->input_dev->name = jack->name;
 
 	/* Default to the sound card device. */
@@ -278,6 +282,8 @@ EXPORT_SYMBOL(snd_jack_new);
 void snd_jack_set_parent(struct snd_jack *jack, struct device *parent)
 {
 	WARN_ON(jack->registered);
+	if (!jack->input_dev)
+		return;
 
 	jack->input_dev->dev.parent = parent;
 }
Signature · 1 line
2.3.6
#5 lore raw
Quoted 45 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, April 30, 2015 9:32 PM
To: Jie, Yang
Cc: Nikula, Jani; Jaroslav Kysela; [email protected]; Tian, YeX
Subject: Re: [for-next] NULL pointer dereference in codec probe

At Thu, 30 Apr 2015 12:27:52 +0000,

Quoted 16 lines · Yang
Quoted 16 lines

-----Original Message-----
From: Jie, Yang
Sent: Thursday, April 30, 2015 7:08 PM
To: 'Takashi Iwai'; Nikula, Jani
Cc: Jaroslav Kysela; [email protected]; Tian, YeX
Subject: RE: [for-next] NULL pointer dereference in codec probe

Quoted 8 lines

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, April 30, 2015 6:23 PM
To: Nikula, Jani
Cc: Jaroslav Kysela; [email protected]; Tian, YeX; Jie, Yang
Subject: Re: [for-next] NULL pointer dereference in codec probe

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines · Jani Nikula

Hi all, our graphics QA found an issue [1] with the for-next branch of [2] merged on top of v4.1-rc1. Backtrace in the bug. I didn't really have time to look into the details, but just letting you

know.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Looks like the new jack stuff broke something. Keyon, could you take a

look?

I noticed this today and root caused it. Will provide a patch for it

tomorrow.

Quoted 5 lines

I just worked out a patch[1] to fix it. no chance to test it yet. will send it to ML once it passed my testing tomorrow.

[1] https://bugs.freedesktop.org/attachment.cgi?id=115474

Quoted 7 lines

I could reproduce the problem on my machine, and checked your patch. It's good per se, but it doesn't suffice. We have to cover all jack->input_dev accesses. The additional fix patch is attached below.

Since the bug is fixed by these patches, I'm going to queue them to topic/jack and for-next branch.

Cool! Thank you Takashi! Then I don't need go to work on May Day. I can try those patches next Monday.

~Keyon

Quoted 45 lines

thanks,

Takashi

-- 8< --
From: Takashi Iwai <[email protected]>
Subject: [PATCH] ALSA: jack: Fix another NULL dereference due to empty input jack

Another fixes for NULL jack->input_dev in some places in jack.c.

Fixes 2ba2dfa1fcc7 ('ALSA: hda - Update to use the new jack kctls method')
---
 sound/core/jack.c | 6 ++++++
 1 file changed, 6 insertions(+)
sound/core/jack.c index renamed from sound/core/jack.c +0 -0

0dbd618e3c94..eb66327b5f1c 100644

sound/core/jack.c +4 -0
@@ -87,6 +87,10 @@ static int snd_jack_dev_register(struct snd_device
 *device)
 
 	snprintf(jack->name, sizeof(jack->name), "%s %s",
 		 card->shortname, jack->id);
+
+	if (!jack->input_dev)
+		return 0;
+
 	jack->input_dev->name = jack->name;
 

/* Default to the sound card device. */ @@ -278,6 +282,8 @@
EXPORT_SYMBOL(snd_jack_new); void snd_jack_set_parent(struct snd_jack *jack, struct device *parent) {

sound/core/jack.c +2 -1
 	WARN_ON(jack->registered);
+	if (!jack->input_dev)
+		return;
 
 	jack->input_dev->dev.parent = parent;
 }
--

2.3.6