sound fixes for 5.3-rc5
Linus,
please pull sound fixes for v5.3-rc5 from:
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git tags/sound-5.3-rc5
The topmost commit is 19bce474c45be69a284ecee660aa12d8f1e88f18
----------------------------------------------------------------
sound fixes for 5.3-rc5
All small fixes targeted for stable:
- Two fixes for USB-audio with malformed descriptor, spotted by fuzzers
- Two fixes Conexant HD-audio codec wrt power management
- Quirks for HD-audio AMD platform and HP laptop
- HD-audio memory leak fix
----------------------------------------------------------------
Hui Peng (2):
ALSA: usb-audio: Fix an OOB bug in parse_audio_mixer_unit
ALSA: usb-audio: Fix a stack buffer overflow bug in check_input_term
Hui Wang (2):
ALSA: hda - Let all conexant codec enter D3 when rebooting
ALSA: hda - Add a generic reboot_notify
Takashi Iwai (2):
ALSA: hda - Apply workaround for another AMD chip 1022:1487
ALSA: hda/realtek - Add quirk for HP Envy x360
Wenwen Wang (1):
ALSA: hda - Fix a memory leak bug
--- sound/pci/hda/hda_generic.c | 21 ++++++++++++++++++++- sound/pci/hda/hda_generic.h | 1 + sound/pci/hda/hda_intel.c | 3 +++ sound/pci/hda/patch_conexant.c | 15 +-------------- sound/pci/hda/patch_realtek.c | 12 ++---------- sound/usb/mixer.c | 37 +++++++++++++++++++++++++++++-------- 6 files changed, 56 insertions(+), 33 deletions(-)
sound/pci/hda/hda_generic.c +20 -1
@@ -6051,6 +6051,24 @@ void snd_hda_gen_free(struct hda_codec *codec) }EXPORT_SYMBOL_GPL (snd_hda_gen_free); +/** +* snd_hda_gen_reboot_notify - Make codec enter D3 before rebooting +* @codec: the HDA codec +* +* This can be put as patch_ops reboot_notify function. +*/ +void snd_hda_gen_reboot_notify (struct hda_codec *codec) +{ +/* Make the codec enter D3 to avoid spurious noises from the internal +* speaker during (and after) reboot +*/ +snd_hda_codec_set_power_to_all (codec, codec->core.afg,AC_PWRST_D3 ); +snd_hda_codec_write (codec, codec->core.afg,0 , +AC_VERB_SET_POWER_STATE ,AC_PWRST_D3 ); +msleep (10 ); +} +EXPORT_SYMBOL_GPL (snd_hda_gen_reboot_notify); +#ifdef CONFIG_PM /** * snd_hda_gen_check_power_status - check the loopback power save state
@@ -6078,6 +6096,7 @@ static const struct hda_codec_ops generic_patch_ops = { .init = snd_hda_gen_init, .free = snd_hda_gen_free, .unsol_event = snd_hda_jack_unsol_event, + .reboot_notify = snd_hda_gen_reboot_notify,#ifdef CONFIG_PM .check_power_status = snd_hda_gen_check_power_status,#endif
@@ -6100,7 +6119,7 @@ static int snd_hda_parse_generic_codec(struct hda_codec *codec) err =snd_hda_parse_pin_defcfg (codec, &spec->autocfg,NULL ,0 );if (err <0 ) -return err; + goto error; err =snd_hda_gen_parse_auto_config (codec, &spec->autocfg);if (err <0 )
sound/pci/hda/hda_generic.h +1 -0
@@ -332,6 +332,7 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec, struct auto_pin_cfg *cfg);int snd_hda_gen_build_controls (struct hda_codec *codec);int snd_hda_gen_build_pcms (struct hda_codec *codec); +void snd_hda_gen_reboot_notify (struct hda_codec *codec);/* standard jack event callbacks */ void snd_hda_gen_hp_automute(struct hda_codec *codec,
sound/pci/hda/hda_intel.c +3 -0
@@ -2508,6 +2508,9 @@ static const struct pci_device_id azx_ids[] = {/* AMD, X370 & co */ { PCI_DEVICE(0x1022, 0x1457), .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_AMD_SB }, + /* AMD, X570 & co */ + { PCI_DEVICE(0x1022, 0x1487), + .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_AMD_SB }, /* AMD Stoney */ { PCI_DEVICE(0x1022, 0x157a), .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB |
sound/pci/hda/patch_conexant.c +1 -14
@@ -163,23 +163,10 @@ static void cx_auto_reboot_notify(struct hda_codec *codec) {struct conexant_spec *spec = codec->spec; -switch (codec->core.vendor_id) { -case 0x14f12008 :/* CX8200 */ -case 0x14f150f2 :/* CX20722 */ -case 0x14f150f4 :/* CX20724 */ -break ; -default : -return ; - } -/* Turn the problematic codec into D3 to avoid spurious noises from the internal speaker during (and after) reboot */ cx_auto_turn_eapd (codec, spec->num_eapds, spec->eapds, false); - -snd_hda_codec_set_power_to_all (codec, codec->core.afg,AC_PWRST_D3 ); -snd_hda_codec_write (codec, codec->core.afg,0 , -AC_VERB_SET_POWER_STATE ,AC_PWRST_D3 ); -msleep (10 ); +snd_hda_gen_reboot_notify (codec); }static void cx_auto_free (struct hda_codec *codec)
sound/pci/hda/patch_realtek.c +2 -10
@@ -869,15 +869,6 @@ static void alc_reboot_notify(struct hda_codec *codec)alc_shutup (codec); } -/* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */ -static void alc_d3_at_reboot (struct hda_codec *codec) -{ -snd_hda_codec_set_power_to_all (codec, codec->core.afg,AC_PWRST_D3 ); -snd_hda_codec_write (codec, codec->core.afg,0 , -AC_VERB_SET_POWER_STATE ,AC_PWRST_D3 ); -msleep (10 ); -} -#define alc_free snd_hda_gen_free#ifdef CONFIG_PM
@@ -5152,7 +5143,7 @@ static void alc_fixup_tpt440_dock(struct hda_codec *codec,struct alc_spec *spec = codec->spec;if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { - spec->reboot_notify = alc_d3_at_reboot;/* reduce noise */ + spec->reboot_notify = snd_hda_gen_reboot_notify;/* reduce noise */ spec->parse_flags =HDA_PINCFG_NO_HP_FIXUP ; codec->power_save_node =0 ;/* avoid click noises */ snd_hda_apply_pincfgs (codec, pincfgs);
@@ -6987,6 +6978,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x82bf ,"HP G3 mini" ,ALC221_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x82c0 ,"HP G3 mini premium" ,ALC221_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x83b9 ,"HP Spectre x360" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ), +SND_PCI_QUIRK (0x103c ,0x8497 ,"HP Envy x360" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x1043 ,0x103e ,"ASUS X540SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x103f ,"ASUS TX300" ,ALC282_FIXUP_ASUS_TX300 ), SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
sound/usb/mixer.c +29 -8
@@ -68,6 +68,7 @@ struct mixer_build {unsigned char *buffer;unsigned int buflen;DECLARE_BITMAP (unitbitmap,MAX_ID_ELEMS ); +DECLARE_BITMAP (termbitmap,MAX_ID_ELEMS );struct usb_audio_term oterm;const struct usbmix_name_map *map;const struct usbmix_selector_map *selector_map;
@@ -744,6 +745,8 @@ static int uac_mixer_unit_get_channels(struct mixer_build *state,return -EINVAL ;if (!desc->bNrInPins)return -EINVAL ; +if (desc->bLength <sizeof (*desc) + desc->bNrInPins) +return -EINVAL ;switch (state->mixer->protocol) {case UAC_VERSION_1 :
@@ -773,16 +776,25 @@ static int uac_mixer_unit_get_channels(struct mixer_build *state,* parse the source unit recursively until it reaches to a terminal * or a branched unit. */ -static int check_input_term (struct mixer_build *state,int id, +static int __check_input_term (struct mixer_build *state,int id,struct usb_audio_term *term) {int protocol = state->mixer->protocol;int err;void *p1; +unsigned char *hdr;memset (term,0 ,sizeof (*term)); -while ((p1 =find_audio_control_unit (state, id)) !=NULL ) { -unsigned char *hdr = p1; +for (;;) { +/* a loop in the terminal chain? */ +if (test_and_set_bit (id, state->termbitmap)) +return -EINVAL ; + + p1 =find_audio_control_unit (state, id); +if (!p1) +break ; + + hdr = p1; term->id = id;if (protocol ==UAC_VERSION_1 || protocol ==UAC_VERSION_2 ) {
@@ -800,7 +812,7 @@ static int check_input_term(struct mixer_build *state, int id,/* call recursively to verify that the * referenced clock entity is valid */ - err =check_input_term (state, d->bCSourceID, term); + err =__check_input_term (state, d->bCSourceID, term);if (err <0 )return err;
@@ -834,7 +846,7 @@ static int check_input_term(struct mixer_build *state, int id,case UAC2_CLOCK_SELECTOR : {struct uac_selector_unit_descriptor *d = p1;/* call recursively to retrieve the channel info */ - err =check_input_term (state, d->baSourceID[0 ], term); + err =__check_input_term (state, d->baSourceID[0 ], term);if (err <0 )return err; term->type =UAC3_SELECTOR_UNIT <<16 ;/* virtual type */
@@ -897,7 +909,7 @@ static int check_input_term(struct mixer_build *state, int id,/* call recursively to verify that the * referenced clock entity is valid */ - err =check_input_term (state, d->bCSourceID, term); + err =__check_input_term (state, d->bCSourceID, term);if (err <0 )return err;
@@ -948,7 +960,7 @@ static int check_input_term(struct mixer_build *state, int id,case UAC3_CLOCK_SELECTOR : {struct uac_selector_unit_descriptor *d = p1;/* call recursively to retrieve the channel info */ - err =check_input_term (state, d->baSourceID[0 ], term); + err =__check_input_term (state, d->baSourceID[0 ], term);if (err <0 )return err; term->type =UAC3_SELECTOR_UNIT <<16 ;/* virtual type */
@@ -964,7 +976,7 @@ static int check_input_term(struct mixer_build *state, int id,return -EINVAL ;/* call recursively to retrieve the channel info */ - err =check_input_term (state, d->baSourceID[0 ], term); + err =__check_input_term (state, d->baSourceID[0 ], term);if (err <0 )return err;
@@ -982,6 +994,15 @@ static int check_input_term(struct mixer_build *state, int id,return -ENODEV ; } + +static int check_input_term (struct mixer_build *state,int id, +struct usb_audio_term *term) +{ +memset (term,0 ,sizeof (*term)); +memset (state->termbitmap,0 ,sizeof (state->termbitmap)); +return __check_input_term (state, id, term); +} +/* * Feature Unit */
The pull request you sent on Fri, 16 Aug 2019 11:17:54 +0200:
The pull request you sent on Fri, 16 Aug 2019 11:17:54 +0200:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.gittags/sound-5.3-rc5
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/cfa0bb2aef998a64d5ad2c065be8511ad98d5d79
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker