Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Pull sound fixes from Takashi Iwai:
"A collection of small fixes as usual:

- More coverage of USB-audio descriptor sanity checks

- A fix for mute LED regression on Conexant HD-audio codecs

- A few device-specific fixes and quirks for USB-audio and HD-audio

- A fix for (die-hard remaining) possible race in sequencer core

- FireWire oxfw regression fix that was introduced in 5.3-rc1"

* tag 'sound-5.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: oxfw: fix to handle correct stream for PCM playback
ALSA: seq: Fix potential concurrent access to the deleted pool
ALSA: usb-audio: Check mixer unit bitmap yet more strictly
ALSA: line6: Fix memory leak at line6_init_pcm() error path
ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate()
ALSA: hda/ca0132 - Add new SBZ quirk
ALSA: usb-audio: Add implicit fb quirk for Behringer UFX1604
ALSA: hda - Fixes inverted Conexant GPIO mic mute led

+73 -32
+1 -2
sound/core/seq/seq_clientmgr.c
··· 1835 1835 if (cptr->type == USER_CLIENT) { 1836 1836 info->input_pool = cptr->data.user.fifo_pool_size; 1837 1837 info->input_free = info->input_pool; 1838 - if (cptr->data.user.fifo) 1839 - info->input_free = snd_seq_unused_cells(cptr->data.user.fifo->pool); 1838 + info->input_free = snd_seq_fifo_unused_cells(cptr->data.user.fifo); 1840 1839 } else { 1841 1840 info->input_pool = 0; 1842 1841 info->input_free = 0;
+17
sound/core/seq/seq_fifo.c
··· 263 263 264 264 return 0; 265 265 } 266 + 267 + /* get the number of unused cells safely */ 268 + int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f) 269 + { 270 + unsigned long flags; 271 + int cells; 272 + 273 + if (!f) 274 + return 0; 275 + 276 + snd_use_lock_use(&f->use_lock); 277 + spin_lock_irqsave(&f->lock, flags); 278 + cells = snd_seq_unused_cells(f->pool); 279 + spin_unlock_irqrestore(&f->lock, flags); 280 + snd_use_lock_free(&f->use_lock); 281 + return cells; 282 + }
+2
sound/core/seq/seq_fifo.h
··· 53 53 /* resize pool in fifo */ 54 54 int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize); 55 55 56 + /* get the number of unused cells safely */ 57 + int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f); 56 58 57 59 #endif
+1 -1
sound/firewire/oxfw/oxfw-pcm.c
··· 248 248 unsigned int channels = params_channels(hw_params); 249 249 250 250 mutex_lock(&oxfw->mutex); 251 - err = snd_oxfw_stream_reserve_duplex(oxfw, &oxfw->tx_stream, 251 + err = snd_oxfw_stream_reserve_duplex(oxfw, &oxfw->rx_stream, 252 252 rate, channels); 253 253 if (err >= 0) 254 254 ++oxfw->substreams_count;
+1
sound/pci/hda/patch_ca0132.c
··· 1175 1175 SND_PCI_QUIRK(0x1028, 0x0708, "Alienware 15 R2 2016", QUIRK_ALIENWARE), 1176 1176 SND_PCI_QUIRK(0x1102, 0x0010, "Sound Blaster Z", QUIRK_SBZ), 1177 1177 SND_PCI_QUIRK(0x1102, 0x0023, "Sound Blaster Z", QUIRK_SBZ), 1178 + SND_PCI_QUIRK(0x1102, 0x0027, "Sound Blaster Z", QUIRK_SBZ), 1178 1179 SND_PCI_QUIRK(0x1102, 0x0033, "Sound Blaster ZxR", QUIRK_SBZ), 1179 1180 SND_PCI_QUIRK(0x1458, 0xA016, "Recon3Di", QUIRK_R3DI), 1180 1181 SND_PCI_QUIRK(0x1458, 0xA026, "Gigabyte G1.Sniper Z97", QUIRK_R3DI),
+9 -8
sound/pci/hda/patch_conexant.c
··· 611 611 612 612 /* update LED status via GPIO */ 613 613 static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask, 614 - bool enabled) 614 + bool led_on) 615 615 { 616 616 struct conexant_spec *spec = codec->spec; 617 617 unsigned int oldval = spec->gpio_led; 618 618 619 619 if (spec->mute_led_polarity) 620 - enabled = !enabled; 620 + led_on = !led_on; 621 621 622 - if (enabled) 623 - spec->gpio_led &= ~mask; 624 - else 622 + if (led_on) 625 623 spec->gpio_led |= mask; 624 + else 625 + spec->gpio_led &= ~mask; 626 + codec_dbg(codec, "mask:%d enabled:%d gpio_led:%d\n", 627 + mask, led_on, spec->gpio_led); 626 628 if (spec->gpio_led != oldval) 627 629 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 628 630 spec->gpio_led); ··· 635 633 { 636 634 struct hda_codec *codec = private_data; 637 635 struct conexant_spec *spec = codec->spec; 638 - 639 - cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); 636 + /* muted -> LED on */ 637 + cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, !enabled); 640 638 } 641 639 642 640 /* turn on/off mic-mute LED via GPIO per capture hook */ ··· 658 656 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03 }, 659 657 {} 660 658 }; 661 - codec_info(codec, "action: %d gpio_led: %d\n", action, spec->gpio_led); 662 659 663 660 if (action == HDA_FIXUP_ACT_PRE_PROBE) { 664 661 spec->gen.vmaster_mute.hook = cxt_fixup_gpio_mute_hook;
+9 -9
sound/usb/line6/pcm.c
··· 550 550 line6pcm->volume_monitor = 255; 551 551 line6pcm->line6 = line6; 552 552 553 + spin_lock_init(&line6pcm->out.lock); 554 + spin_lock_init(&line6pcm->in.lock); 555 + line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD; 556 + 557 + line6->line6pcm = line6pcm; 558 + 559 + pcm->private_data = line6pcm; 560 + pcm->private_free = line6_cleanup_pcm; 561 + 553 562 line6pcm->max_packet_size_in = 554 563 usb_maxpacket(line6->usbdev, 555 564 usb_rcvisocpipe(line6->usbdev, ep_read), 0); ··· 570 561 "cannot get proper max packet size\n"); 571 562 return -EINVAL; 572 563 } 573 - 574 - spin_lock_init(&line6pcm->out.lock); 575 - spin_lock_init(&line6pcm->in.lock); 576 - line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD; 577 - 578 - line6->line6pcm = line6pcm; 579 - 580 - pcm->private_data = line6pcm; 581 - pcm->private_free = line6_cleanup_pcm; 582 564 583 565 err = line6_create_audio_out_urbs(line6pcm); 584 566 if (err < 0)
+28 -8
sound/usb/mixer.c
··· 739 739 struct uac_mixer_unit_descriptor *desc) 740 740 { 741 741 int mu_channels; 742 - void *c; 743 742 744 743 if (desc->bLength < sizeof(*desc)) 745 744 return -EINVAL; ··· 760 761 uac3_mixer_unit_wClusterDescrID(desc)); 761 762 break; 762 763 } 763 - 764 - if (!mu_channels) 765 - return 0; 766 - 767 - c = uac_mixer_unit_bmControls(desc, state->mixer->protocol); 768 - if (c - (void *)desc + (mu_channels - 1) / 8 >= desc->bLength) 769 - return 0; /* no bmControls -> skip */ 770 764 771 765 return mu_channels; 772 766 } ··· 2001 2009 * Mixer Unit 2002 2010 */ 2003 2011 2012 + /* check whether the given in/out overflows bmMixerControls matrix */ 2013 + static bool mixer_bitmap_overflow(struct uac_mixer_unit_descriptor *desc, 2014 + int protocol, int num_ins, int num_outs) 2015 + { 2016 + u8 *hdr = (u8 *)desc; 2017 + u8 *c = uac_mixer_unit_bmControls(desc, protocol); 2018 + size_t rest; /* remaining bytes after bmMixerControls */ 2019 + 2020 + switch (protocol) { 2021 + case UAC_VERSION_1: 2022 + default: 2023 + rest = 1; /* iMixer */ 2024 + break; 2025 + case UAC_VERSION_2: 2026 + rest = 2; /* bmControls + iMixer */ 2027 + break; 2028 + case UAC_VERSION_3: 2029 + rest = 6; /* bmControls + wMixerDescrStr */ 2030 + break; 2031 + } 2032 + 2033 + /* overflow? */ 2034 + return c + (num_ins * num_outs + 7) / 8 + rest > hdr + hdr[0]; 2035 + } 2036 + 2004 2037 /* 2005 2038 * build a mixer unit control 2006 2039 * ··· 2154 2137 if (err < 0) 2155 2138 return err; 2156 2139 num_ins += iterm.channels; 2140 + if (mixer_bitmap_overflow(desc, state->mixer->protocol, 2141 + num_ins, num_outs)) 2142 + break; 2157 2143 for (; ich < num_ins; ich++) { 2158 2144 int och, ich_has_controls = 0; 2159 2145
+4 -4
sound/usb/mixer_quirks.c
··· 1155 1155 { 1156 1156 struct usb_mixer_interface *mixer; 1157 1157 struct usb_mixer_elem_info *cval; 1158 - int unitid = 12; /* SamleRate ExtensionUnit ID */ 1158 + int unitid = 12; /* SampleRate ExtensionUnit ID */ 1159 1159 1160 1160 list_for_each_entry(mixer, &chip->mixer_list, list) { 1161 - cval = mixer_elem_list_to_info(mixer->id_elems[unitid]); 1162 - if (cval) { 1161 + if (mixer->id_elems[unitid]) { 1162 + cval = mixer_elem_list_to_info(mixer->id_elems[unitid]); 1163 1163 snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR, 1164 1164 cval->control << 8, 1165 1165 samplerate_id); 1166 1166 snd_usb_mixer_notify_id(mixer, unitid); 1167 + break; 1167 1168 } 1168 - break; 1169 1169 } 1170 1170 } 1171 1171
+1
sound/usb/pcm.c
··· 339 339 ep = 0x81; 340 340 ifnum = 2; 341 341 goto add_sync_ep_from_ifnum; 342 + case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */ 342 343 case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */ 343 344 ep = 0x81; 344 345 ifnum = 1;