Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Jie, Yang" <yang.jie@intel.com>
Cc: "Nikula, Jani" <jani.nikula@intel.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"Tian, YeX" <yex.tian@intel.com>
Subject: Re: [for-next] NULL pointer dereference in codec probe
Date: Thu, 30 Apr 2015 15:31:33 +0200	[thread overview]
Message-ID: <s5hfv7heo96.wl-tiwai@suse.de> (raw)
In-Reply-To: <E7B1D079BA13FB44A978CC8F69C7D6A905523951@SHSMSX101.ccr.corp.intel.com>

At Thu, 30 Apr 2015 12:27:52 +0000,
Jie, Yang wrote:
> 
> > -----Original Message-----
> > From: Jie, Yang
> > Sent: Thursday, April 30, 2015 7:08 PM
> > To: 'Takashi Iwai'; Nikula, Jani
> > Cc: Jaroslav Kysela; alsa-devel@alsa-project.org; Tian, YeX
> > Subject: RE: [for-next] NULL pointer dereference in codec probe
> > 
> > > -----Original Message-----
> > > From: Takashi Iwai [mailto:tiwai@suse.de]
> > > Sent: Thursday, April 30, 2015 6:23 PM
> > > To: Nikula, Jani
> > > Cc: Jaroslav Kysela; alsa-devel@alsa-project.org; Tian, YeX; Jie, Yang
> > > Subject: Re: [for-next] NULL pointer dereference in codec probe
> > >
> > > At Thu, 30 Apr 2015 13:06:41 +0300,
> > > Jani Nikula wrote:
> > > >
> > > >
> > > > 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

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 <tiwai@suse.de>
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')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/jack.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/core/jack.c b/sound/core/jack.c
index 0dbd618e3c94..eb66327b5f1c 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -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;
 }
-- 
2.3.6

  reply	other threads:[~2015-04-30 13:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 10:06 [for-next] NULL pointer dereference in codec probe Jani Nikula
2015-04-30 10:23 ` Takashi Iwai
2015-04-30 11:07   ` Jie, Yang
2015-04-30 12:27   ` Jie, Yang
2015-04-30 13:31     ` Takashi Iwai [this message]
2015-04-30 13:53       ` Jie, Yang

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=s5hfv7heo96.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=jani.nikula@intel.com \
    --cc=yang.jie@intel.com \
    --cc=yex.tian@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox