From fd4de308fb898ab81eb36782744e161588d35b2c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 13 Jul 2020 17:36:54 +0200 Subject: [PATCH] 4.14-stable patches added patches: alsa-hda-let-hs_mic-be-picked-ahead-of-hp_mic.patch alsa-opl3-fix-infoleak-in-opl3.patch alsa-usb-audio-add-quirk-for-macrosilicon-ms2109.patch --- ...let-hs_mic-be-picked-ahead-of-hp_mic.patch | 59 ++++++++++++++ .../alsa-opl3-fix-infoleak-in-opl3.patch | 37 +++++++++ ...io-add-quirk-for-macrosilicon-ms2109.patch | 81 +++++++++++++++++++ 3 files changed, 177 insertions(+) create mode 100644 queue-4.14/alsa-hda-let-hs_mic-be-picked-ahead-of-hp_mic.patch create mode 100644 queue-4.14/alsa-opl3-fix-infoleak-in-opl3.patch create mode 100644 queue-4.14/alsa-usb-audio-add-quirk-for-macrosilicon-ms2109.patch diff --git a/queue-4.14/alsa-hda-let-hs_mic-be-picked-ahead-of-hp_mic.patch b/queue-4.14/alsa-hda-let-hs_mic-be-picked-ahead-of-hp_mic.patch new file mode 100644 index 00000000000..70d686b9ed8 --- /dev/null +++ b/queue-4.14/alsa-hda-let-hs_mic-be-picked-ahead-of-hp_mic.patch @@ -0,0 +1,59 @@ +From 6a6ca7881b1ab1c13fe0d70bae29211a65dd90de Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Thu, 25 Jun 2020 16:38:33 +0800 +Subject: ALSA: hda - let hs_mic be picked ahead of hp_mic + +From: Hui Wang + +commit 6a6ca7881b1ab1c13fe0d70bae29211a65dd90de upstream. + +We have a Dell AIO, there is neither internal speaker nor internal +mic, only a multi-function audio jack on it. + +Users reported that after freshly installing the OS and plug +a headset to the audio jack, the headset can't output sound. I +reproduced this bug, at that moment, the Input Source is as below: +Simple mixer control 'Input Source',0 + Capabilities: cenum + Items: 'Headphone Mic' 'Headset Mic' + Item0: 'Headphone Mic' + +That is because the patch_realtek will set this audio jack as mic_in +mode if Input Source's value is hp_mic. + +If it is not fresh installing, this issue will not happen since the +systemd will run alsactl restore -f /var/lib/alsa/asound.state, this +will set the 'Input Source' according to history value. + +If there is internal speaker or internal mic, this issue will not +happen since there is valid sink/source in the pulseaudio, the PA will +set the 'Input Source' according to active_port. + +To fix this issue, change the parser function to let the hs_mic be +stored ahead of hp_mic. + +Cc: stable@vger.kernel.org +Signed-off-by: Hui Wang +Link: https://lore.kernel.org/r/20200625083833.11264-1-hui.wang@canonical.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_auto_parser.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/sound/pci/hda/hda_auto_parser.c ++++ b/sound/pci/hda/hda_auto_parser.c +@@ -76,6 +76,12 @@ static int compare_input_type(const void + if (a->type != b->type) + return (int)(a->type - b->type); + ++ /* If has both hs_mic and hp_mic, pick the hs_mic ahead of hp_mic. */ ++ if (a->is_headset_mic && b->is_headphone_mic) ++ return -1; /* don't swap */ ++ else if (a->is_headphone_mic && b->is_headset_mic) ++ return 1; /* swap */ ++ + /* In case one has boost and the other one has not, + pick the one with boost first. */ + return (int)(b->has_boost_on_pin - a->has_boost_on_pin); diff --git a/queue-4.14/alsa-opl3-fix-infoleak-in-opl3.patch b/queue-4.14/alsa-opl3-fix-infoleak-in-opl3.patch new file mode 100644 index 00000000000..4bde46f705e --- /dev/null +++ b/queue-4.14/alsa-opl3-fix-infoleak-in-opl3.patch @@ -0,0 +1,37 @@ +From ad155712bb1ea2151944cf06a0e08c315c70c1e3 Mon Sep 17 00:00:00 2001 +From: xidongwang +Date: Sun, 5 Jul 2020 20:27:38 -0700 +Subject: ALSA: opl3: fix infoleak in opl3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: xidongwang + +commit ad155712bb1ea2151944cf06a0e08c315c70c1e3 upstream. + +The stack object “info” in snd_opl3_ioctl() has a leaking problem. +It has 2 padding bytes which are not initialized and leaked via +“copy_to_user”. + +Signed-off-by: xidongwang +Cc: +Link: https://lore.kernel.org/r/1594006058-30362-1-git-send-email-wangxidong_97@163.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/drivers/opl3/opl3_synth.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/drivers/opl3/opl3_synth.c ++++ b/sound/drivers/opl3/opl3_synth.c +@@ -104,6 +104,8 @@ int snd_opl3_ioctl(struct snd_hwdep * hw + { + struct snd_dm_fm_info info; + ++ memset(&info, 0, sizeof(info)); ++ + info.fm_mode = opl3->fm_mode; + info.rhythm = opl3->rhythm; + if (copy_to_user(argp, &info, sizeof(struct snd_dm_fm_info))) diff --git a/queue-4.14/alsa-usb-audio-add-quirk-for-macrosilicon-ms2109.patch b/queue-4.14/alsa-usb-audio-add-quirk-for-macrosilicon-ms2109.patch new file mode 100644 index 00000000000..155a22f54e6 --- /dev/null +++ b/queue-4.14/alsa-usb-audio-add-quirk-for-macrosilicon-ms2109.patch @@ -0,0 +1,81 @@ +From e337bf19f6af38d5c3fa6d06cd594e0f890ca1ac Mon Sep 17 00:00:00 2001 +From: Hector Martin +Date: Thu, 2 Jul 2020 16:14:33 +0900 +Subject: ALSA: usb-audio: add quirk for MacroSilicon MS2109 + +From: Hector Martin + +commit e337bf19f6af38d5c3fa6d06cd594e0f890ca1ac upstream. + +These devices claim to be 96kHz mono, but actually are 48kHz stereo with +swapped channels and unaligned transfers. + +Cc: stable@vger.kernel.org +Signed-off-by: Hector Martin +Link: https://lore.kernel.org/r/20200702071433.237843-1-marcan@marcan.st +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/quirks-table.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 52 insertions(+) + +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -3323,4 +3323,56 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge + } + }, + ++/* ++ * MacroSilicon MS2109 based HDMI capture cards ++ * ++ * These claim 96kHz 1ch in the descriptors, but are actually 48kHz 2ch. ++ * They also need QUIRK_AUDIO_ALIGN_TRANSFER, which makes one wonder if ++ * they pretend to be 96kHz mono as a workaround for stereo being broken ++ * by that... ++ * ++ * They also have swapped L-R channels, but that's for userspace to deal ++ * with. ++ */ ++{ ++ USB_DEVICE(0x534d, 0x2109), ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .vendor_name = "MacroSilicon", ++ .product_name = "MS2109", ++ .ifnum = QUIRK_ANY_INTERFACE, ++ .type = QUIRK_COMPOSITE, ++ .data = &(const struct snd_usb_audio_quirk[]) { ++ { ++ .ifnum = 2, ++ .type = QUIRK_AUDIO_ALIGN_TRANSFER, ++ }, ++ { ++ .ifnum = 2, ++ .type = QUIRK_AUDIO_STANDARD_MIXER, ++ }, ++ { ++ .ifnum = 3, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels = 2, ++ .iface = 3, ++ .altsetting = 1, ++ .altset_idx = 1, ++ .attributes = 0, ++ .endpoint = 0x82, ++ .ep_attr = USB_ENDPOINT_XFER_ISOC | ++ USB_ENDPOINT_SYNC_ASYNC, ++ .rates = SNDRV_PCM_RATE_CONTINUOUS, ++ .rate_min = 48000, ++ .rate_max = 48000, ++ } ++ }, ++ { ++ .ifnum = -1 ++ } ++ } ++ } ++}, ++ + #undef USB_DEVICE_VENDOR_SPEC -- 2.47.3