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

Pull sound fixes from Takashi Iwai:
"A collection of a few more small fixes for HD- and USB-audio,
including a regression fix for the OOB fix that was included
in the previous pull request"

* tag 'sound-6.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: hda/realtek: ALC269 fixup for Lenovo Yoga Book 9i 13IRU8 audio
ALSA: hda/realtek: Add quirk for Samsung 730QED to fix headphone
ALSA: usb-audio: Use the right limit for PCM OOB check
ALSA: usb-audio: Fix use-after-free in snd_usb_mixer_free()
ALSA: hda/realtek: Fix headset mic for TongFang X6AR55xU
ALSA: ctxfi: Fix potential OOB access in audio mixer handling
selftests: ALSA: Remove unused variable in utimer-test
ALSA: usb-audio: Add delay quirk for MOONDROP Moonriver2 Ti
ALSA: scarlett2: Fix buffer overflow in config retrieval
ALSA: usb: Increase volume range that triggers a warning

+54 -11
+28 -1
sound/hda/codecs/realtek/alc269.c
··· 3736 3736 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, 3737 3737 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, 3738 3738 ALC298_FIXUP_LENOVO_C940_DUET7, 3739 + ALC287_FIXUP_LENOVO_YOGA_BOOK_9I, 3739 3740 ALC287_FIXUP_13S_GEN2_SPEAKERS, 3740 3741 ALC256_FIXUP_SET_COEF_DEFAULTS, 3741 3742 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE, ··· 3821 3820 id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */ 3822 3821 else 3823 3822 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */ 3823 + __snd_hda_apply_fixup(codec, id, action, 0); 3824 + } 3825 + 3826 + /* A special fixup for Lenovo Yoga 9i and Yoga Book 9i 13IRU8 3827 + * both have the very same PCI SSID and vendor ID, so we need 3828 + * to apply different fixups depending on the subsystem ID 3829 + */ 3830 + static void alc287_fixup_lenovo_yoga_book_9i(struct hda_codec *codec, 3831 + const struct hda_fixup *fix, 3832 + int action) 3833 + { 3834 + int id; 3835 + 3836 + if (codec->core.subsystem_id == 0x17aa3881) 3837 + id = ALC287_FIXUP_TAS2781_I2C; /* Yoga Book 9i 13IRU8 */ 3838 + else 3839 + id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP; /* Yoga 9i */ 3824 3840 __snd_hda_apply_fixup(codec, id, action, 0); 3825 3841 } 3826 3842 ··· 5852 5834 .type = HDA_FIXUP_FUNC, 5853 5835 .v.func = alc298_fixup_lenovo_c940_duet7, 5854 5836 }, 5837 + [ALC287_FIXUP_LENOVO_YOGA_BOOK_9I] = { 5838 + .type = HDA_FIXUP_FUNC, 5839 + .v.func = alc287_fixup_lenovo_yoga_book_9i, 5840 + }, 5855 5841 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = { 5856 5842 .type = HDA_FIXUP_VERBS, 5857 5843 .v.verbs = (const struct hda_verb[]) { ··· 7035 7013 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP), 7036 7014 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP), 7037 7015 SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 7016 + SND_PCI_QUIRK(0x144d, 0xc876, "Samsung 730QED (NP730QED-KA2US)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 7038 7017 SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP), 7039 7018 SND_PCI_QUIRK(0x144d, 0xca06, "Samsung Galaxy Book3 360 (NP730QFG)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 7040 7019 SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP), ··· 7214 7191 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF), 7215 7192 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), 7216 7193 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS), 7217 - SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP), 7194 + SND_PCI_QUIRK(0x17aa, 0x3843, "Lenovo Yoga 9i / Yoga Book 9i", ALC287_FIXUP_LENOVO_YOGA_BOOK_9I), 7218 7195 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6), 7219 7196 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), 7220 7197 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), ··· 7805 7782 {0x12, 0x90a60140}, 7806 7783 {0x19, 0x04a11030}, 7807 7784 {0x21, 0x04211020}), 7785 + SND_HDA_PIN_QUIRK(0x10ec0274, 0x1d05, "TongFang", ALC274_FIXUP_HP_HEADSET_MIC, 7786 + {0x17, 0x90170110}, 7787 + {0x19, 0x03a11030}, 7788 + {0x21, 0x03211020}), 7808 7789 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT, 7809 7790 ALC282_STANDARD_PINS, 7810 7791 {0x12, 0x90a609c0},
+2
sound/pci/ctxfi/ctamixer.c
··· 205 205 206 206 /* Set amixer specific operations */ 207 207 amixer->rsc.ops = &amixer_basic_rsc_ops; 208 + amixer->rsc.conj = 0; 208 209 amixer->ops = &amixer_ops; 209 210 amixer->input = NULL; 210 211 amixer->sum = NULL; ··· 368 367 return err; 369 368 370 369 sum->rsc.ops = &sum_basic_rsc_ops; 370 + sum->rsc.conj = 0; 371 371 372 372 return 0; 373 373 }
+17 -5
sound/usb/mixer.c
··· 1813 1813 1814 1814 range = (cval->max - cval->min) / cval->res; 1815 1815 /* 1816 - * Are there devices with volume range more than 255? I use a bit more 1817 - * to be sure. 384 is a resolution magic number found on Logitech 1818 - * devices. It will definitively catch all buggy Logitech devices. 1816 + * There are definitely devices with a range of ~20,000, so let's be 1817 + * conservative and allow for a bit more. 1819 1818 */ 1820 - if (range > 384) { 1819 + if (range > 65535) { 1821 1820 usb_audio_warn(mixer->chip, 1822 1821 "Warning! Unlikely big volume range (=%u), cval->res is probably wrong.", 1823 1822 range); ··· 2945 2946 2946 2947 static void snd_usb_mixer_free(struct usb_mixer_interface *mixer) 2947 2948 { 2949 + struct usb_mixer_elem_list *list, *next; 2950 + int id; 2951 + 2948 2952 /* kill pending URBs */ 2949 2953 snd_usb_mixer_disconnect(mixer); 2950 2954 2951 - kfree(mixer->id_elems); 2955 + /* Unregister controls first, snd_ctl_remove() frees the element */ 2956 + if (mixer->id_elems) { 2957 + for (id = 0; id < MAX_ID_ELEMS; id++) { 2958 + for (list = mixer->id_elems[id]; list; list = next) { 2959 + next = list->next_id_elem; 2960 + if (list->kctl) 2961 + snd_ctl_remove(mixer->chip->card, list->kctl); 2962 + } 2963 + } 2964 + kfree(mixer->id_elems); 2965 + } 2952 2966 if (mixer->urb) { 2953 2967 kfree(mixer->urb->transfer_buffer); 2954 2968 usb_free_urb(mixer->urb);
+3 -3
sound/usb/mixer_scarlett2.c
··· 2533 2533 err = scarlett2_usb_get(mixer, config_item->offset, buf, size); 2534 2534 if (err < 0) 2535 2535 return err; 2536 - if (size == 2) { 2536 + if (config_item->size == 16) { 2537 2537 u16 *buf_16 = buf; 2538 2538 2539 2539 for (i = 0; i < count; i++, buf_16++) 2540 2540 *buf_16 = le16_to_cpu(*(__le16 *)buf_16); 2541 - } else if (size == 4) { 2542 - u32 *buf_32 = buf; 2541 + } else if (config_item->size == 32) { 2542 + u32 *buf_32 = (u32 *)buf; 2543 2543 2544 2544 for (i = 0; i < count; i++, buf_32++) 2545 2545 *buf_32 = le32_to_cpu(*(__le32 *)buf_32);
+2 -1
sound/usb/pcm.c
··· 1553 1553 1554 1554 for (i = 0; i < ctx->packets; i++) { 1555 1555 counts = snd_usb_endpoint_next_packet_size(ep, ctx, i, avail); 1556 - if (counts < 0 || frames + counts >= ep->max_urb_frames) 1556 + if (counts < 0 || 1557 + (frames + counts) * stride > ctx->buffer_size) 1557 1558 break; 1558 1559 /* set up descriptor */ 1559 1560 urb->iso_frame_desc[i].offset = frames * stride;
+2
sound/usb/quirks.c
··· 2390 2390 QUIRK_FLAG_CTL_MSG_DELAY_1M), 2391 2391 DEVICE_FLG(0x2d99, 0x0026, /* HECATE G2 GAMING HEADSET */ 2392 2392 QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE), 2393 + DEVICE_FLG(0x2fc6, 0xf06b, /* MOONDROP Moonriver2 Ti */ 2394 + QUIRK_FLAG_CTL_MSG_DELAY), 2393 2395 DEVICE_FLG(0x2fc6, 0xf0b7, /* iBasso DC07 Pro */ 2394 2396 QUIRK_FLAG_CTL_MSG_DELAY_1M), 2395 2397 DEVICE_FLG(0x30be, 0x0101, /* Schiit Hel */
-1
tools/testing/selftests/alsa/utimer-test.c
··· 141 141 TEST(wrong_timers_test) { 142 142 int timer_dev_fd; 143 143 int utimer_fd; 144 - size_t i; 145 144 struct snd_timer_uinfo wrong_timer = { 146 145 .resolution = 0, 147 146 .id = UTIMER_DEFAULT_ID,