aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-29 17:53:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-29 17:53:33 -0400
commit9a4a6f0dc1eaa7b5e4a834b13596faeb0d4b7ac3 (patch)
tree83f1f62365b0d2c9cafb73f401d190145e87e9ee
parent0e40da3efeb02ab0333d01abae20d421841db30a (diff)
parente2a829b3da01b9b32c4d0291d042b8a6e2a98ca3 (diff)
Merge tag 'sound-5.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "The important fixes at this time are a couple fixes in ALSA core: a fix for PCM is about the OOB access in PCM OSS plugins that has been for long time, but hasn't hit so often until now just because we allocated a large buffer via vmalloc(), and surfaced more often after switching to kvmalloc(). Another fix is for a long-standing PCM problem wrt racy PM resume. Others are trivial nospec coverage and usual HD-audio quirks" * tag 'sound-5.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda/realtek - Fix speakers on Acer Predator Helios 500 Ryzen laptops ALSA: pcm: Don't suspend stream in unrecoverable PCM state ALSA: hda/ca0132 - Simplify alt firmware loading code ALSA: pcm: Fix possible OOB access in PCM oss plugins ALSA: hda/realtek: Enable headset MIC of ASUS X430UN and X512DK with ALC256 ALSA: hda/realtek: Enable headset mic of ASUS P5440FF with ALC256 ALSA: hda/realtek: Enable ASUS X441MB and X705FD headset MIC with ALC256 ALSA: hda/realtek - Add support for Acer Aspire E5-523G/ES1-432 headset mic ALSA: hda/realtek: Enable headset MIC of Acer Aspire Z24-890 with ALC286 ALSA: seq: oss: Fix Spectre v1 vulnerability ALSA: rawmidi: Fix potential Spectre v1 vulnerability
-rw-r--r--sound/core/oss/pcm_oss.c43
-rw-r--r--sound/core/pcm_native.c9
-rw-r--r--sound/core/rawmidi.c2
-rw-r--r--sound/core/seq/oss/seq_oss_synth.c7
-rw-r--r--sound/pci/hda/patch_ca0132.c20
-rw-r--r--sound/pci/hda/patch_realtek.c35
6 files changed, 77 insertions, 39 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index d5b0d7ba83c4..f6ae68017608 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -940,6 +940,28 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
940 oss_frame_size = snd_pcm_format_physical_width(params_format(params)) * 940 oss_frame_size = snd_pcm_format_physical_width(params_format(params)) *
941 params_channels(params) / 8; 941 params_channels(params) / 8;
942 942
943 err = snd_pcm_oss_period_size(substream, params, sparams);
944 if (err < 0)
945 goto failure;
946
947 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size);
948 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, n, NULL);
949 if (err < 0)
950 goto failure;
951
952 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIODS,
953 runtime->oss.periods, NULL);
954 if (err < 0)
955 goto failure;
956
957 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
958
959 err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams);
960 if (err < 0) {
961 pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err);
962 goto failure;
963 }
964
943#ifdef CONFIG_SND_PCM_OSS_PLUGINS 965#ifdef CONFIG_SND_PCM_OSS_PLUGINS
944 snd_pcm_oss_plugin_clear(substream); 966 snd_pcm_oss_plugin_clear(substream);
945 if (!direct) { 967 if (!direct) {
@@ -974,27 +996,6 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
974 } 996 }
975#endif 997#endif
976 998
977 err = snd_pcm_oss_period_size(substream, params, sparams);
978 if (err < 0)
979 goto failure;
980
981 n = snd_pcm_plug_slave_size(substream, runtime->oss.period_bytes / oss_frame_size);
982 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, n, NULL);
983 if (err < 0)
984 goto failure;
985
986 err = snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_PERIODS,
987 runtime->oss.periods, NULL);
988 if (err < 0)
989 goto failure;
990
991 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
992
993 if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams)) < 0) {
994 pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err);
995 goto failure;
996 }
997
998 if (runtime->oss.trigger) { 999 if (runtime->oss.trigger) {
999 sw_params->start_threshold = 1; 1000 sw_params->start_threshold = 1;
1000 } else { 1001 } else {
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index f731f904e8cc..1d8452912b14 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1445,8 +1445,15 @@ static int snd_pcm_pause(struct snd_pcm_substream *substream, int push)
1445static int snd_pcm_pre_suspend(struct snd_pcm_substream *substream, int state) 1445static int snd_pcm_pre_suspend(struct snd_pcm_substream *substream, int state)
1446{ 1446{
1447 struct snd_pcm_runtime *runtime = substream->runtime; 1447 struct snd_pcm_runtime *runtime = substream->runtime;
1448 if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) 1448 switch (runtime->status->state) {
1449 case SNDRV_PCM_STATE_SUSPENDED:
1449 return -EBUSY; 1450 return -EBUSY;
1451 /* unresumable PCM state; return -EBUSY for skipping suspend */
1452 case SNDRV_PCM_STATE_OPEN:
1453 case SNDRV_PCM_STATE_SETUP:
1454 case SNDRV_PCM_STATE_DISCONNECTED:
1455 return -EBUSY;
1456 }
1450 runtime->trigger_master = substream; 1457 runtime->trigger_master = substream;
1451 return 0; 1458 return 0;
1452} 1459}
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index ee601d7f0926..c0690d1ecd55 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -30,6 +30,7 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/mm.h> 32#include <linux/mm.h>
33#include <linux/nospec.h>
33#include <sound/rawmidi.h> 34#include <sound/rawmidi.h>
34#include <sound/info.h> 35#include <sound/info.h>
35#include <sound/control.h> 36#include <sound/control.h>
@@ -601,6 +602,7 @@ static int __snd_rawmidi_info_select(struct snd_card *card,
601 return -ENXIO; 602 return -ENXIO;
602 if (info->stream < 0 || info->stream > 1) 603 if (info->stream < 0 || info->stream > 1)
603 return -EINVAL; 604 return -EINVAL;
605 info->stream = array_index_nospec(info->stream, 2);
604 pstr = &rmidi->streams[info->stream]; 606 pstr = &rmidi->streams[info->stream];
605 if (pstr->substream_count == 0) 607 if (pstr->substream_count == 0)
606 return -ENOENT; 608 return -ENOENT;
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c
index 278ebb993122..c93945917235 100644
--- a/sound/core/seq/oss/seq_oss_synth.c
+++ b/sound/core/seq/oss/seq_oss_synth.c
@@ -617,13 +617,14 @@ int
617snd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_info *inf) 617snd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_info *inf)
618{ 618{
619 struct seq_oss_synth *rec; 619 struct seq_oss_synth *rec;
620 struct seq_oss_synthinfo *info = get_synthinfo_nospec(dp, dev);
620 621
621 if (dev < 0 || dev >= dp->max_synthdev) 622 if (!info)
622 return -ENXIO; 623 return -ENXIO;
623 624
624 if (dp->synths[dev].is_midi) { 625 if (info->is_midi) {
625 struct midi_info minf; 626 struct midi_info minf;
626 snd_seq_oss_midi_make_info(dp, dp->synths[dev].midi_mapped, &minf); 627 snd_seq_oss_midi_make_info(dp, info->midi_mapped, &minf);
627 inf->synth_type = SYNTH_TYPE_MIDI; 628 inf->synth_type = SYNTH_TYPE_MIDI;
628 inf->synth_subtype = 0; 629 inf->synth_subtype = 0;
629 inf->nr_voices = 16; 630 inf->nr_voices = 16;
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 29882bda7632..e1ebc6d5f382 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -1005,7 +1005,6 @@ struct ca0132_spec {
1005 unsigned int scp_resp_header; 1005 unsigned int scp_resp_header;
1006 unsigned int scp_resp_data[4]; 1006 unsigned int scp_resp_data[4];
1007 unsigned int scp_resp_count; 1007 unsigned int scp_resp_count;
1008 bool alt_firmware_present;
1009 bool startup_check_entered; 1008 bool startup_check_entered;
1010 bool dsp_reload; 1009 bool dsp_reload;
1011 1010
@@ -7518,7 +7517,7 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec)
7518 bool dsp_loaded = false; 7517 bool dsp_loaded = false;
7519 struct ca0132_spec *spec = codec->spec; 7518 struct ca0132_spec *spec = codec->spec;
7520 const struct dsp_image_seg *dsp_os_image; 7519 const struct dsp_image_seg *dsp_os_image;
7521 const struct firmware *fw_entry; 7520 const struct firmware *fw_entry = NULL;
7522 /* 7521 /*
7523 * Alternate firmwares for different variants. The Recon3Di apparently 7522 * Alternate firmwares for different variants. The Recon3Di apparently
7524 * can use the default firmware, but I'll leave the option in case 7523 * can use the default firmware, but I'll leave the option in case
@@ -7529,33 +7528,26 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec)
7529 case QUIRK_R3D: 7528 case QUIRK_R3D:
7530 case QUIRK_AE5: 7529 case QUIRK_AE5:
7531 if (request_firmware(&fw_entry, DESKTOP_EFX_FILE, 7530 if (request_firmware(&fw_entry, DESKTOP_EFX_FILE,
7532 codec->card->dev) != 0) { 7531 codec->card->dev) != 0)
7533 codec_dbg(codec, "Desktop firmware not found."); 7532 codec_dbg(codec, "Desktop firmware not found.");
7534 spec->alt_firmware_present = false; 7533 else
7535 } else {
7536 codec_dbg(codec, "Desktop firmware selected."); 7534 codec_dbg(codec, "Desktop firmware selected.");
7537 spec->alt_firmware_present = true;
7538 }
7539 break; 7535 break;
7540 case QUIRK_R3DI: 7536 case QUIRK_R3DI:
7541 if (request_firmware(&fw_entry, R3DI_EFX_FILE, 7537 if (request_firmware(&fw_entry, R3DI_EFX_FILE,
7542 codec->card->dev) != 0) { 7538 codec->card->dev) != 0)
7543 codec_dbg(codec, "Recon3Di alt firmware not detected."); 7539 codec_dbg(codec, "Recon3Di alt firmware not detected.");
7544 spec->alt_firmware_present = false; 7540 else
7545 } else {
7546 codec_dbg(codec, "Recon3Di firmware selected."); 7541 codec_dbg(codec, "Recon3Di firmware selected.");
7547 spec->alt_firmware_present = true;
7548 }
7549 break; 7542 break;
7550 default: 7543 default:
7551 spec->alt_firmware_present = false;
7552 break; 7544 break;
7553 } 7545 }
7554 /* 7546 /*
7555 * Use default ctefx.bin if no alt firmware is detected, or if none 7547 * Use default ctefx.bin if no alt firmware is detected, or if none
7556 * exists for your particular codec. 7548 * exists for your particular codec.
7557 */ 7549 */
7558 if (!spec->alt_firmware_present) { 7550 if (!fw_entry) {
7559 codec_dbg(codec, "Default firmware selected."); 7551 codec_dbg(codec, "Default firmware selected.");
7560 if (request_firmware(&fw_entry, EFX_FILE, 7552 if (request_firmware(&fw_entry, EFX_FILE,
7561 codec->card->dev) != 0) 7553 codec->card->dev) != 0)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 191830d4fa40..a3fb3d4c5730 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5688,6 +5688,8 @@ enum {
5688 ALC225_FIXUP_WYSE_AUTO_MUTE, 5688 ALC225_FIXUP_WYSE_AUTO_MUTE,
5689 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF, 5689 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
5690 ALC286_FIXUP_ACER_AIO_HEADSET_MIC, 5690 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
5691 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
5692 ALC299_FIXUP_PREDATOR_SPK,
5691}; 5693};
5692 5694
5693static const struct hda_fixup alc269_fixups[] = { 5695static const struct hda_fixup alc269_fixups[] = {
@@ -6696,6 +6698,22 @@ static const struct hda_fixup alc269_fixups[] = {
6696 .chained = true, 6698 .chained = true,
6697 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE 6699 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
6698 }, 6700 },
6701 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6702 .type = HDA_FIXUP_PINS,
6703 .v.pins = (const struct hda_pintbl[]) {
6704 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6705 { }
6706 },
6707 .chained = true,
6708 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6709 },
6710 [ALC299_FIXUP_PREDATOR_SPK] = {
6711 .type = HDA_FIXUP_PINS,
6712 .v.pins = (const struct hda_pintbl[]) {
6713 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
6714 { }
6715 }
6716 },
6699}; 6717};
6700 6718
6701static const struct snd_pci_quirk alc269_fixup_tbl[] = { 6719static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -6712,9 +6730,13 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6712 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), 6730 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
6713 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), 6731 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6714 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK), 6732 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
6733 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
6734 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
6735 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
6715 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), 6736 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6716 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), 6737 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6717 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), 6738 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6739 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6718 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), 6740 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
6719 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 6741 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6720 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), 6742 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
@@ -7111,6 +7133,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
7111 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"}, 7133 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
7112 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"}, 7134 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
7113 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-sense-combo"}, 7135 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-sense-combo"},
7136 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
7114 {} 7137 {}
7115}; 7138};
7116#define ALC225_STANDARD_PINS \ 7139#define ALC225_STANDARD_PINS \
@@ -7331,6 +7354,18 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
7331 {0x14, 0x90170110}, 7354 {0x14, 0x90170110},
7332 {0x1b, 0x90a70130}, 7355 {0x1b, 0x90a70130},
7333 {0x21, 0x03211020}), 7356 {0x21, 0x03211020}),
7357 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7358 {0x12, 0x90a60130},
7359 {0x14, 0x90170110},
7360 {0x21, 0x03211020}),
7361 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7362 {0x12, 0x90a60130},
7363 {0x14, 0x90170110},
7364 {0x21, 0x04211020}),
7365 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7366 {0x1a, 0x90a70130},
7367 {0x1b, 0x90170110},
7368 {0x21, 0x03211020}),
7334 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, 7369 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7335 {0x12, 0xb7a60130}, 7370 {0x12, 0xb7a60130},
7336 {0x13, 0xb8a61140}, 7371 {0x13, 0xb8a61140},