Pull sound fixes from Takashi Iwai: "A few fixes covering the issues reported by syzkaller, a couple of fixes for the MIDI decoding bug, and a few usual HD-audio quirks. Some of them are about ALSA core stuff, but they are small fixes just for corner cases, and nothing thrilling" * tag 'sound-5.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda/realtek - Enable the headset of Acer N50-600 with ALC662 ALSA: hda/realtek - Enable headset mic of Acer X2660G with ALC662 ALSA: seq: oss: Fix running status after receiving sysex ALSA: seq: virmidi: Fix running status after receiving sysex ALSA: pcm: oss: Remove WARNING from snd_pcm_plug_alloc() checks ALSA: hda/realtek: Fix pop noise on ALC225 ALSA: line6: Fix endless MIDI read loop ALSA: pcm: oss: Avoid plugin buffer overflow
Unified · Split
| @@ -111,7 +111,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) · 110 unmodified lines | |||
| 111 | while (plugin->next) { | 111 | while (plugin->next) { |
| 112 | if (plugin->dst_frames) | 112 | if (plugin->dst_frames) |
| 113 | frames = plugin->dst_frames(plugin, frames); | 113 | frames = plugin->dst_frames(plugin, frames); |
| 114 | if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) | 114 | if ((snd_pcm_sframes_t)frames <= 0) |
| 115 | return -ENXIO; | 115 | return -ENXIO; |
| 116 | plugin = plugin->next; | 116 | plugin = plugin->next; |
| 117 | err = snd_pcm_plugin_alloc(plugin, frames); | 117 | err = snd_pcm_plugin_alloc(plugin, frames); |
| @@ -123,7 +123,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) · 5 unmodified lines | |||
| 123 | while (plugin->prev) { | 123 | while (plugin->prev) { |
| 124 | if (plugin->src_frames) | 124 | if (plugin->src_frames) |
| 125 | frames = plugin->src_frames(plugin, frames); | 125 | frames = plugin->src_frames(plugin, frames); |
| 126 | if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) | 126 | if ((snd_pcm_sframes_t)frames <= 0) |
| 127 | return -ENXIO; | 127 | return -ENXIO; |
| 128 | plugin = plugin->prev; | 128 | plugin = plugin->prev; |
| 129 | err = snd_pcm_plugin_alloc(plugin, frames); | 129 | err = snd_pcm_plugin_alloc(plugin, frames); |
| @@ -209,6 +209,8 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p · 79 unmodified lines | |||
| 209 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { | 209 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 210 | plugin = snd_pcm_plug_last(plug); | 210 | plugin = snd_pcm_plug_last(plug); |
| 211 | while (plugin && drv_frames > 0) { | 211 | while (plugin && drv_frames > 0) { |
| 212 | if (drv_frames > plugin->buf_frames) | ||
| 213 | drv_frames = plugin->buf_frames; | ||
| 212 | plugin_prev = plugin->prev; | 214 | plugin_prev = plugin->prev; |
| 213 | if (plugin->src_frames) | 215 | if (plugin->src_frames) |
| 214 | drv_frames = plugin->src_frames(plugin, drv_frames); | 216 | drv_frames = plugin->src_frames(plugin, drv_frames); |
| @@ -220,6 +222,8 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p · 5 unmodified lines | |||
| 220 | plugin_next = plugin->next; | 222 | plugin_next = plugin->next; |
| 221 | if (plugin->dst_frames) | 223 | if (plugin->dst_frames) |
| 222 | drv_frames = plugin->dst_frames(plugin, drv_frames); | 224 | drv_frames = plugin->dst_frames(plugin, drv_frames); |
| 225 | if (drv_frames > plugin->buf_frames) | ||
| 226 | drv_frames = plugin->buf_frames; | ||
| 223 | plugin = plugin_next; | 227 | plugin = plugin_next; |
| 224 | } | 228 | } |
| 225 | } else | 229 | } else |
| @@ -248,11 +252,15 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc · 22 unmodified lines | |||
| 248 | if (frames < 0) | 252 | if (frames < 0) |
| 249 | return frames; | 253 | return frames; |
| 250 | } | 254 | } |
| 255 | if (frames > plugin->buf_frames) | ||
| 256 | frames = plugin->buf_frames; | ||
| 251 | plugin = plugin_next; | 257 | plugin = plugin_next; |
| 252 | } | 258 | } |
| 253 | } else if (stream == SNDRV_PCM_STREAM_CAPTURE) { | 259 | } else if (stream == SNDRV_PCM_STREAM_CAPTURE) { |
| 254 | plugin = snd_pcm_plug_last(plug); | 260 | plugin = snd_pcm_plug_last(plug); |
| 255 | while (plugin) { | 261 | while (plugin) { |
| 262 | if (frames > plugin->buf_frames) | ||
| 263 | frames = plugin->buf_frames; | ||
| 256 | plugin_prev = plugin->prev; | 264 | plugin_prev = plugin->prev; |
| 257 | if (plugin->src_frames) { | 265 | if (plugin->src_frames) { |
| 258 | frames = plugin->src_frames(plugin, frames); | 266 | frames = plugin->src_frames(plugin, frames); |
| @@ -602,6 +602,7 @@ send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, struct seq · 601 unmodified lines | |||
| 602 | len = snd_seq_oss_timer_start(dp->timer); | 602 | len = snd_seq_oss_timer_start(dp->timer); |
| 603 | if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { | 603 | if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { |
| 604 | snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev); | 604 | snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev); |
| 605 | snd_midi_event_reset_decode(mdev->coder); | ||
| 605 | } else { | 606 | } else { |
| 606 | len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev); | 607 | len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev); |
| 607 | if (len > 0) | 608 | if (len > 0) |
| @@ -81,6 +81,7 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev, · 80 unmodified lines | |||
| 81 | if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) | 81 | if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) |
| 82 | continue; | 82 | continue; |
| 83 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream); | 83 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream); |
| 84 | snd_midi_event_reset_decode(vmidi->parser); | ||
| 84 | } else { | 85 | } else { |
| 85 | len = snd_midi_event_decode(vmidi->parser, msg, sizeof(msg), ev); | 86 | len = snd_midi_event_decode(vmidi->parser, msg, sizeof(msg), ev); |
| 86 | if (len > 0) | 87 | if (len > 0) |
| @@ -8051,6 +8051,8 @@ static int patch_alc269(struct hda_codec *codec) · 8050 unmodified lines | |||
| 8051 | spec->gen.mixer_nid = 0; | 8051 | spec->gen.mixer_nid = 0; |
| 8052 | break; | 8052 | break; |
| 8053 | case 0x10ec0225: | 8053 | case 0x10ec0225: |
| 8054 | codec->power_save_node = 1; | ||
| 8055 | /* fall through */ | ||
| 8054 | case 0x10ec0295: | 8056 | case 0x10ec0295: |
| 8055 | case 0x10ec0299: | 8057 | case 0x10ec0299: |
| 8056 | spec->codec_variant = ALC269_TYPE_ALC225; | 8058 | spec->codec_variant = ALC269_TYPE_ALC225; |
| @@ -8610,6 +8612,8 @@ enum { · 553 unmodified lines | |||
| 8610 | ALC669_FIXUP_ACER_ASPIRE_ETHOS, | 8612 | ALC669_FIXUP_ACER_ASPIRE_ETHOS, |
| 8611 | ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET, | 8613 | ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET, |
| 8612 | ALC671_FIXUP_HP_HEADSET_MIC2, | 8614 | ALC671_FIXUP_HP_HEADSET_MIC2, |
| 8615 | ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, | ||
| 8616 | ALC662_FIXUP_ACER_NITRO_HEADSET_MODE, | ||
| 8613 | }; | 8617 | }; |
| 8614 | 8618 | ||
| 8615 | static const struct hda_fixup alc662_fixups[] = { | 8619 | static const struct hda_fixup alc662_fixups[] = { |
| @@ -8955,6 +8959,25 @@ static const struct hda_fixup alc662_fixups[] = { · 339 unmodified lines | |||
| 8955 | .type = HDA_FIXUP_FUNC, | 8959 | .type = HDA_FIXUP_FUNC, |
| 8956 | .v.func = alc671_fixup_hp_headset_mic2, | 8960 | .v.func = alc671_fixup_hp_headset_mic2, |
| 8957 | }, | 8961 | }, |
| 8962 | [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = { | ||
| 8963 | .type = HDA_FIXUP_PINS, | ||
| 8964 | .v.pins = (const struct hda_pintbl[]) { | ||
| 8965 | { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */ | ||
| 8966 | { } | ||
| 8967 | }, | ||
| 8968 | .chained = true, | ||
| 8969 | .chain_id = ALC662_FIXUP_USI_FUNC | ||
| 8970 | }, | ||
| 8971 | [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = { | ||
| 8972 | .type = HDA_FIXUP_PINS, | ||
| 8973 | .v.pins = (const struct hda_pintbl[]) { | ||
| 8974 | { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */ | ||
| 8975 | { 0x1b, 0x0221144f }, | ||
| 8976 | { } | ||
| 8977 | }, | ||
| 8978 | .chained = true, | ||
| 8979 | .chain_id = ALC662_FIXUP_USI_FUNC | ||
| 8980 | }, | ||
| 8958 | }; | 8981 | }; |
| 8959 | 8982 | ||
| 8960 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { | 8983 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
| @@ -8966,6 +8989,8 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { · 5 unmodified lines | |||
| 8966 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), | 8989 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), |
| 8967 | SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC), | 8990 | SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC), |
| 8968 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), | 8991 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
| 8992 | SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE), | ||
| 8993 | SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE), | ||
| 8969 | SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 8994 | SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
| 8970 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 8995 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
| 8971 | SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13), | 8996 | SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13), |
| @@ -305,7 +305,7 @@ static void line6_data_received(struct urb *urb) · 304 unmodified lines | |||
| 305 | line6_midibuf_read(mb, line6->buffer_message, | 305 | line6_midibuf_read(mb, line6->buffer_message, |
| 306 | LINE6_MIDI_MESSAGE_MAXLEN); | 306 | LINE6_MIDI_MESSAGE_MAXLEN); |
| 307 | 307 | ||
| 308 | if (done == 0) | 308 | if (done <= 0) |
| 309 | break; | 309 | break; |
| 310 | 310 | ||
| 311 | line6->message_length = done; | 311 | line6->message_length = done; |
| @@ -159,7 +159,7 @@ int line6_midibuf_read(struct midi_buffer *this, unsigned char *data, · 158 unmodified lines | |||
| 159 | int midi_length_prev = | 159 | int midi_length_prev = |
| 160 | midibuf_message_length(this->command_prev); | 160 | midibuf_message_length(this->command_prev); |
| 161 | 161 | ||
| 162 | if (midi_length_prev > 0) { | 162 | if (midi_length_prev > 1) { |
| 163 | midi_length = midi_length_prev - 1; | 163 | midi_length = midi_length_prev - 1; |
| 164 | repeat = 1; | 164 | repeat = 1; |
| 165 | } else | 165 | } else |