Commit 4b609f1e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'sound-5.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Two core fixes for long-standing bugs for the races at concurrent
  device creation and deletion that were (unsurprisingly) spotted by
  syzkaller with usb-fuzzer.

  The rest are usual small HD-audio fixes"

* tag 'sound-5.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda/realtek - add two more pin configuration sets to quirk table
  ALSA: core: Fix card races between register and disconnect
  ALSA: info: Fix racy addition/deletion of nodes
  ALSA: hda: Initialize power_state field properly
parents e899cc3b b26e36b7
...@@ -713,8 +713,11 @@ snd_info_create_entry(const char *name, struct snd_info_entry *parent, ...@@ -713,8 +713,11 @@ snd_info_create_entry(const char *name, struct snd_info_entry *parent,
INIT_LIST_HEAD(&entry->list); INIT_LIST_HEAD(&entry->list);
entry->parent = parent; entry->parent = parent;
entry->module = module; entry->module = module;
if (parent) if (parent) {
mutex_lock(&parent->access);
list_add_tail(&entry->list, &parent->children); list_add_tail(&entry->list, &parent->children);
mutex_unlock(&parent->access);
}
return entry; return entry;
} }
...@@ -792,7 +795,12 @@ void snd_info_free_entry(struct snd_info_entry * entry) ...@@ -792,7 +795,12 @@ void snd_info_free_entry(struct snd_info_entry * entry)
list_for_each_entry_safe(p, n, &entry->children, list) list_for_each_entry_safe(p, n, &entry->children, list)
snd_info_free_entry(p); snd_info_free_entry(p);
list_del(&entry->list); p = entry->parent;
if (p) {
mutex_lock(&p->access);
list_del(&entry->list);
mutex_unlock(&p->access);
}
kfree(entry->name); kfree(entry->name);
if (entry->private_free) if (entry->private_free)
entry->private_free(entry); entry->private_free(entry);
......
...@@ -382,14 +382,7 @@ int snd_card_disconnect(struct snd_card *card) ...@@ -382,14 +382,7 @@ int snd_card_disconnect(struct snd_card *card)
card->shutdown = 1; card->shutdown = 1;
spin_unlock(&card->files_lock); spin_unlock(&card->files_lock);
/* phase 1: disable fops (user space) operations for ALSA API */ /* replace file->f_op with special dummy operations */
mutex_lock(&snd_card_mutex);
snd_cards[card->number] = NULL;
clear_bit(card->number, snd_cards_lock);
mutex_unlock(&snd_card_mutex);
/* phase 2: replace file->f_op with special dummy operations */
spin_lock(&card->files_lock); spin_lock(&card->files_lock);
list_for_each_entry(mfile, &card->files_list, list) { list_for_each_entry(mfile, &card->files_list, list) {
/* it's critical part, use endless loop */ /* it's critical part, use endless loop */
...@@ -405,7 +398,7 @@ int snd_card_disconnect(struct snd_card *card) ...@@ -405,7 +398,7 @@ int snd_card_disconnect(struct snd_card *card)
} }
spin_unlock(&card->files_lock); spin_unlock(&card->files_lock);
/* phase 3: notify all connected devices about disconnection */ /* notify all connected devices about disconnection */
/* at this point, they cannot respond to any calls except release() */ /* at this point, they cannot respond to any calls except release() */
#if IS_ENABLED(CONFIG_SND_MIXER_OSS) #if IS_ENABLED(CONFIG_SND_MIXER_OSS)
...@@ -421,6 +414,13 @@ int snd_card_disconnect(struct snd_card *card) ...@@ -421,6 +414,13 @@ int snd_card_disconnect(struct snd_card *card)
device_del(&card->card_dev); device_del(&card->card_dev);
card->registered = false; card->registered = false;
} }
/* disable fops (user space) operations for ALSA API */
mutex_lock(&snd_card_mutex);
snd_cards[card->number] = NULL;
clear_bit(card->number, snd_cards_lock);
mutex_unlock(&snd_card_mutex);
#ifdef CONFIG_PM #ifdef CONFIG_PM
wake_up(&card->power_sleep); wake_up(&card->power_sleep);
#endif #endif
......
...@@ -969,6 +969,7 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card, ...@@ -969,6 +969,7 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card,
/* power-up all before initialization */ /* power-up all before initialization */
hda_set_power_state(codec, AC_PWRST_D0); hda_set_power_state(codec, AC_PWRST_D0);
codec->core.dev.power.power_state = PMSG_ON;
snd_hda_codec_proc_new(codec); snd_hda_codec_proc_new(codec);
......
...@@ -7266,6 +7266,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -7266,6 +7266,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x12, 0x90a60140}, {0x12, 0x90a60140},
{0x14, 0x90170150}, {0x14, 0x90170150},
{0x21, 0x02211020}), {0x21, 0x02211020}),
SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
{0x21, 0x02211020}),
SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
{0x14, 0x90170110}, {0x14, 0x90170110},
{0x21, 0x02211020}), {0x21, 0x02211020}),
...@@ -7376,6 +7378,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -7376,6 +7378,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x21, 0x0221101f}), {0x21, 0x0221101f}),
SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
ALC256_STANDARD_PINS), ALC256_STANDARD_PINS),
SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
{0x14, 0x90170110},
{0x1b, 0x01011020},
{0x21, 0x0221101f}),
SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC, SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
{0x14, 0x90170110}, {0x14, 0x90170110},
{0x1b, 0x90a70130}, {0x1b, 0x90a70130},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment