Skip to content

Commit

Permalink
ALSA: hda - Don't call vmaster hook when bus->shutdown is set
Browse files Browse the repository at this point in the history
The flag bus->shutdown implies that the control elements might have
been already destroyed.  When a codec is resumed at this state and
tries to call vmaster hook (e.g. in snd_hda_gen_init()), it would
refer to a non-existing object, resulting in Oops in the end.

This patch just adds a check of the flag in the caller side for
avoiding such a crash.

Though, the best would be to clear hook->sw_kctl by the destructor of
the corresponding ctl element, but vmaster uses its own private_free,
it can't be done easily.  So let it be for a while.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Apr 17, 2013
1 parent 83f26ad commit 594813f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2784,6 +2784,11 @@ void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook)
{
if (!hook->hook || !hook->codec)
return;
/* don't call vmaster hook in the destructor since it might have
* been already destroyed
*/
if (hook->codec->bus->shutdown)
return;
switch (hook->mute_mode) {
case HDA_VMUTE_FOLLOW_MASTER:
snd_ctl_sync_vmaster_hook(hook->sw_kctl);
Expand Down

0 comments on commit 594813f

Please sign in to comment.