Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, broonie@kernel.org, tiwai@suse.com,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	yong.zhi@intel.com
Subject: Re: [PATCH] ALSA: hda: fix NULL pointer dereference during suspend
Date: Thu, 30 Jul 2020 10:33:59 -0700	[thread overview]
Message-ID: <89a066fa22fc5dd00782dfcdd7f6b2d36a5f8d67.camel@linux.intel.com> (raw)
In-Reply-To: <s5hd04dcfss.wl-tiwai@suse.de>

On Thu, 2020-07-30 at 15:07 +0200, Takashi Iwai wrote:
> On Wed, 29 Jul 2020 18:06:25 +0200,
> Takashi Iwai wrote:
> > On Wed, 29 Jul 2020 17:03:22 +0200,
> > Ranjani Sridharan wrote:
> > > On Wed, 2020-07-29 at 09:48 +0200, Takashi Iwai wrote:
> > > > On Wed, 29 Jul 2020 01:10:11 +0200,
> > > > Ranjani Sridharan wrote:
> > > > > When the ASoC card registration fails and the codec component
> > > > > driver
> > > > > never probes, the codec device is not initialized and
> > > > > therefore
> > > > > memory for codec->wcaps is not allocated. This results in a
> > > > > NULL
> > > > > pointer
> > > > > dereference when the codec driver suspend callback is invoked
> > > > > during
> > > > > system suspend. Fix this by returning without performing any
> > > > > actions
> > > > > during codec suspend/resume if the card was not registered
> > > > > successfully.
> > > > > 
> > > > > Reviewed-by: Pierre-Louis Bossart <
> > > > > pierre-louis.bossart@linux.intel.com>
> > > > > Signed-off-by: Ranjani Sridharan <
> > > > > ranjani.sridharan@linux.intel.com
> > > > 
> > > > The code changes look OK to apply, but I still wonder how the
> > > > runtime
> > > > PM gets invoked even if the device is not instantiated
> > > > properly?
> > > Hi Takashi,
> > > 
> > > Its not runtime PM suspend but rather the system PM suspend
> > > callback
> > > that is invoked when the system is suspended that ends up
> > > callling the
> > > the runtime PM callback. So, the sequence is:
> > > hda_codec_pm_suspend()
> > >    -> pm_runtime_force_suspend()
> > >           -> hda_codec_runtime_suspend()
> > 
> > OK, but the problem is still same.  The basic problem is that the
> > hda_codec_driver_probe() is called for the hda_codec object that
> > hasn't been initialized and bypasses to ext_ops.hdev_attach.
> > 
> > So, we can factor out the fundamental part of
> > snd_hda_codec_device_new() that is irrelevant with the card object
> > and
> > call it in hdac_hda_dev_probe().
> 
> I meant something like below (totally untested)
Thanks, Takashi. I can test this out and get back to you by next week.

Thanks,
Ranjani


      reply	other threads:[~2020-07-30 17:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 23:10 [PATCH] ALSA: hda: fix NULL pointer dereference during suspend Ranjani Sridharan
2020-07-29  7:48 ` Takashi Iwai
2020-07-29  9:39   ` Mark Brown
2020-07-29 15:03   ` Ranjani Sridharan
2020-07-29 16:06     ` Takashi Iwai
2020-07-30 13:07       ` Takashi Iwai
2020-07-30 17:33         ` Ranjani Sridharan [this message]

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=89a066fa22fc5dd00782dfcdd7f6b2d36a5f8d67.camel@linux.intel.com \
    --to=ranjani.sridharan@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    --cc=yong.zhi@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