sound fixes for 5.1-rc6

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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAly6ywQOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE9uUg//VwKpvt8496LIp74P4C++gfSj2IGdDWR5h2sV
 X0YucwUV3ILIQ2lhhAKh8JgxIhsqbNnS0JALLb07/U70GqxUJsVj8gzVGCpoTS0J
 cuk9U5+2qh2vUKBYTzu1SQyYAnoCEDsw8vf8aewmfcrjEQJc7Mm2gkD86wAhn01G
 pC0yuf5YLqBv1HtsNp9NE6yF9mbPuvgUwC/ZD3YscwXi32vZSEmx/CIjBzYEJ/0p
 y56xUxr9MSAmNk7+OVCMftP7v0c7pxpbVyMqF6p9zLrgu9IDBmtK4XBCVv47O/bm
 WQApeYdjrGeYzfa1aFuO2d6WbLdHZWvPOrEAkSAaoBevit0rkvUNqfHvRDzBkqgI
 KGIhv6NtaM2JVfF/PcEK4dIX2UFe0PWmQXSdBOb4oxXohei+avxE4r3T+O2IX5wF
 EY4pPcqY0XQSuRZ4u3MFT7jOZHUQweVQzWEEoE8sWy0tJyKhXvmBVRZ+B0So4SvR
 l4z40gvoaVbJc8osKh5UcH8QvCGFTlFwgRVdCZvYBD8YRMf2nsIUFGgj4I2ZZ1M1
 4OceaOTqC1KcGPXEJcEAuzOHBVDXyClOXWO+Bvbx2oLGx19J9QNFu+ypcZbrU4xk
 zfGtPfTruu5HAjFKchndTFp6LmkPw6tUsQOauBMvwSNIYL+Vl87jRPK5gvoc1bg5
 2gpTzwY=
 =kpz9
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2019-04-20 10:19:30 -07:00
commit 4b609f1e26
4 changed files with 26 additions and 11 deletions

View File

@ -713,8 +713,11 @@ snd_info_create_entry(const char *name, struct snd_info_entry *parent,
INIT_LIST_HEAD(&entry->list);
entry->parent = parent;
entry->module = module;
if (parent)
if (parent) {
mutex_lock(&parent->access);
list_add_tail(&entry->list, &parent->children);
mutex_unlock(&parent->access);
}
return 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)
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);
if (entry->private_free)
entry->private_free(entry);

View File

@ -382,14 +382,7 @@ int snd_card_disconnect(struct snd_card *card)
card->shutdown = 1;
spin_unlock(&card->files_lock);
/* phase 1: 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);
/* phase 2: replace file->f_op with special dummy operations */
/* replace file->f_op with special dummy operations */
spin_lock(&card->files_lock);
list_for_each_entry(mfile, &card->files_list, list) {
/* it's critical part, use endless loop */
@ -405,7 +398,7 @@ int snd_card_disconnect(struct snd_card *card)
}
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() */
#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
@ -421,6 +414,13 @@ int snd_card_disconnect(struct snd_card *card)
device_del(&card->card_dev);
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
wake_up(&card->power_sleep);
#endif

View File

@ -969,6 +969,7 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card,
/* power-up all before initialization */
hda_set_power_state(codec, AC_PWRST_D0);
codec->core.dev.power.power_state = PMSG_ON;
snd_hda_codec_proc_new(codec);

View File

@ -7266,6 +7266,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x12, 0x90a60140},
{0x14, 0x90170150},
{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,
{0x14, 0x90170110},
{0x21, 0x02211020}),
@ -7376,6 +7378,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x21, 0x0221101f}),
SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
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,
{0x14, 0x90170110},
{0x1b, 0x90a70130},