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 | 111 | while (plugin->next) { |
| 112 | 112 | if (plugin->dst_frames) |
| 113 | 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 | 115 | return -ENXIO; |
| 116 | 116 | plugin = plugin->next; |
| 117 | 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 | 123 | while (plugin->prev) { |
| 124 | 124 | if (plugin->src_frames) |
| 125 | 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 | 127 | return -ENXIO; |
| 128 | 128 | plugin = plugin->prev; |
| 129 | 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 | 209 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 210 | 210 | plugin = snd_pcm_plug_last(plug); |
| 211 | 211 | while (plugin && drv_frames > 0) { |
| 212 | + if (drv_frames > plugin->buf_frames) | |
| 213 | + drv_frames = plugin->buf_frames; | |
| 212 | 214 | plugin_prev = plugin->prev; |
| 213 | 215 | if (plugin->src_frames) |
| 214 | 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 | 222 | plugin_next = plugin->next; |
| 221 | 223 | if (plugin->dst_frames) |
| 222 | 224 | drv_frames = plugin->dst_frames(plugin, drv_frames); |
| 225 | + if (drv_frames > plugin->buf_frames) | |
| 226 | + drv_frames = plugin->buf_frames; | |
| 223 | 227 | plugin = plugin_next; |
| 224 | 228 | } |
| 225 | 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 | 252 | if (frames < 0) |
| 249 | 253 | return frames; |
| 250 | 254 | } |
| 255 | + if (frames > plugin->buf_frames) | |
| 256 | + frames = plugin->buf_frames; | |
| 251 | 257 | plugin = plugin_next; |
| 252 | 258 | } |
| 253 | 259 | } else if (stream == SNDRV_PCM_STREAM_CAPTURE) { |
| 254 | 260 | plugin = snd_pcm_plug_last(plug); |
| 255 | 261 | while (plugin) { |
| 262 | + if (frames > plugin->buf_frames) | |
| 263 | + frames = plugin->buf_frames; | |
| 256 | 264 | plugin_prev = plugin->prev; |
| 257 | 265 | if (plugin->src_frames) { |
| 258 | 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 | 602 | len = snd_seq_oss_timer_start(dp->timer); |
| 603 | 603 | if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { |
| 604 | 604 | snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev); |
| 605 | + snd_midi_event_reset_decode(mdev->coder); | |
| 605 | 606 | } else { |
| 606 | 607 | len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev); |
| 607 | 608 | if (len > 0) |
| @@ -81,6 +81,7 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev, · 80 unmodified lines | ||
| 81 | 81 | if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) |
| 82 | 82 | continue; |
| 83 | 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 | 85 | } else { |
| 85 | 86 | len = snd_midi_event_decode(vmidi->parser, msg, sizeof(msg), ev); |
| 86 | 87 | if (len > 0) |
| @@ -8051,6 +8051,8 @@ static int patch_alc269(struct hda_codec *codec) · 8050 unmodified lines | ||
| 8051 | 8051 | spec->gen.mixer_nid = 0; |
| 8052 | 8052 | break; |
| 8053 | 8053 | case 0x10ec0225: |
| 8054 | + codec->power_save_node = 1; | |
| 8055 | + /* fall through */ | |
| 8054 | 8056 | case 0x10ec0295: |
| 8055 | 8057 | case 0x10ec0299: |
| 8056 | 8058 | spec->codec_variant = ALC269_TYPE_ALC225; |
| @@ -8610,6 +8612,8 @@ enum { · 553 unmodified lines | ||
| 8610 | 8612 | ALC669_FIXUP_ACER_ASPIRE_ETHOS, |
| 8611 | 8613 | ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET, |
| 8612 | 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 | 8619 | static const struct hda_fixup alc662_fixups[] = { |
| @@ -8955,6 +8959,25 @@ static const struct hda_fixup alc662_fixups[] = { · 339 unmodified lines | ||
| 8955 | 8959 | .type = HDA_FIXUP_FUNC, |
| 8956 | 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 | 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 | 8989 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), |
| 8967 | 8990 | SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC), |
| 8968 | 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 | 8994 | SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
| 8970 | 8995 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
| 8971 | 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 | 305 | line6_midibuf_read(mb, line6->buffer_message, |
| 306 | 306 | LINE6_MIDI_MESSAGE_MAXLEN); |
| 307 | 307 | |
| 308 | − if (done == 0) | |
| 308 | + if (done <= 0) | |
| 309 | 309 | break; |
| 310 | 310 | |
| 311 | 311 | line6->message_length = done; |
| @@ -159,7 +159,7 @@ int line6_midibuf_read(struct midi_buffer *this, unsigned char *data, · 158 unmodified lines | ||
| 159 | 159 | int midi_length_prev = |
| 160 | 160 | midibuf_message_length(this->command_prev); |
| 161 | 161 | |
| 162 | − if (midi_length_prev > 0) { | |
| 162 | + if (midi_length_prev > 1) { | |
| 163 | 163 | midi_length = midi_length_prev - 1; |
| 164 | 164 | repeat = 1; |
| 165 | 165 | } else |