Skip to content

Commit 11ac7cc

Browse files
committed
Merge tag 'sound-5.4-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "A few small last-minute fixes for USB-audio and HD-audio as well as for PCM core: - A race fix for PCM core between stopping and closing a stream - USB-audio regressions in the recent descriptor validation code and relevant changes - A read of uninitialized value in USB-audio spotted by fuzzer - A fix for USB-audio race at stopping a stream - Intel HD-audio platform fixes" * tag 'sound-5.4-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: usb-audio: Fix incorrect size check for processing/extension units ALSA: usb-audio: Fix incorrect NULL check in create_yamaha_midi_quirk() ALSA: pcm: Fix stream lock usage in snd_pcm_period_elapsed() ALSA: usb-audio: not submit urb for stopped endpoint ALSA: hda: hdmi - fix pin setup on Tigerlake ALSA: hda: Add Cometlake-S PCI ID ALSA: usb-audio: Fix missing error check at mixer resolution test
2 parents 37b49f3 + 976a68f commit 11ac7cc

File tree

7 files changed

+23
-9
lines changed

7 files changed

+23
-9
lines changed

sound/core/pcm_lib.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,11 +1782,14 @@ void snd_pcm_period_elapsed(struct snd_pcm_substream *substream)
17821782
struct snd_pcm_runtime *runtime;
17831783
unsigned long flags;
17841784

1785-
if (PCM_RUNTIME_CHECK(substream))
1785+
if (snd_BUG_ON(!substream))
17861786
return;
1787-
runtime = substream->runtime;
17881787

17891788
snd_pcm_stream_lock_irqsave(substream, flags);
1789+
if (PCM_RUNTIME_CHECK(substream))
1790+
goto _unlock;
1791+
runtime = substream->runtime;
1792+
17901793
if (!snd_pcm_running(substream) ||
17911794
snd_pcm_update_hw_ptr0(substream, 1) < 0)
17921795
goto _end;
@@ -1797,6 +1800,7 @@ void snd_pcm_period_elapsed(struct snd_pcm_substream *substream)
17971800
#endif
17981801
_end:
17991802
kill_fasync(&runtime->fasync, SIGIO, POLL_IN);
1803+
_unlock:
18001804
snd_pcm_stream_unlock_irqrestore(substream, flags);
18011805
}
18021806
EXPORT_SYMBOL(snd_pcm_period_elapsed);

sound/pci/hda/hda_intel.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,9 @@ static const struct pci_device_id azx_ids[] = {
23962396
/* CometLake-H */
23972397
{ PCI_DEVICE(0x8086, 0x06C8),
23982398
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
2399+
/* CometLake-S */
2400+
{ PCI_DEVICE(0x8086, 0xa3f0),
2401+
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
23992402
/* Icelake */
24002403
{ PCI_DEVICE(0x8086, 0x34c8),
24012404
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},

sound/pci/hda/patch_hdmi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");
4646
((codec)->core.vendor_id == 0x80862800))
4747
#define is_cannonlake(codec) ((codec)->core.vendor_id == 0x8086280c)
4848
#define is_icelake(codec) ((codec)->core.vendor_id == 0x8086280f)
49+
#define is_tigerlake(codec) ((codec)->core.vendor_id == 0x80862812)
4950
#define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec) \
5051
|| is_skylake(codec) || is_broxton(codec) \
5152
|| is_kabylake(codec) || is_geminilake(codec) \
52-
|| is_cannonlake(codec) || is_icelake(codec))
53+
|| is_cannonlake(codec) || is_icelake(codec) \
54+
|| is_tigerlake(codec))
5355
#define is_valleyview(codec) ((codec)->core.vendor_id == 0x80862882)
5456
#define is_cherryview(codec) ((codec)->core.vendor_id == 0x80862883)
5557
#define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec))

sound/usb/endpoint.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ static void snd_complete_urb(struct urb *urb)
388388
}
389389

390390
prepare_outbound_urb(ep, ctx);
391+
/* can be stopped during prepare callback */
392+
if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
393+
goto exit_clear;
391394
} else {
392395
retire_inbound_urb(ep, ctx);
393396
/* can be stopped during retire callback */

sound/usb/mixer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,8 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
12291229
if (cval->min + cval->res < cval->max) {
12301230
int last_valid_res = cval->res;
12311231
int saved, test, check;
1232-
get_cur_mix_raw(cval, minchn, &saved);
1232+
if (get_cur_mix_raw(cval, minchn, &saved) < 0)
1233+
goto no_res_check;
12331234
for (;;) {
12341235
test = saved;
12351236
if (test < cval->max)
@@ -1249,6 +1250,7 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
12491250
snd_usb_set_cur_mix_value(cval, minchn, 0, saved);
12501251
}
12511252

1253+
no_res_check:
12521254
cval->initialized = 1;
12531255
}
12541256

sound/usb/quirks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ static int create_yamaha_midi_quirk(struct snd_usb_audio *chip,
248248
NULL, USB_MS_MIDI_OUT_JACK);
249249
if (!injd && !outjd)
250250
return -ENODEV;
251-
if (!(injd && snd_usb_validate_midi_desc(injd)) ||
252-
!(outjd && snd_usb_validate_midi_desc(outjd)))
251+
if ((injd && !snd_usb_validate_midi_desc(injd)) ||
252+
(outjd && !snd_usb_validate_midi_desc(outjd)))
253253
return -ENODEV;
254254
if (injd && (injd->bLength < 5 ||
255255
(injd->bJackType != USB_MS_EMBEDDED &&

sound/usb/validate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ static bool validate_processing_unit(const void *p,
8181
switch (v->protocol) {
8282
case UAC_VERSION_1:
8383
default:
84-
/* bNrChannels, wChannelConfig, iChannelNames, bControlSize */
85-
len += 1 + 2 + 1 + 1;
86-
if (d->bLength < len) /* bControlSize */
84+
/* bNrChannels, wChannelConfig, iChannelNames */
85+
len += 1 + 2 + 1;
86+
if (d->bLength < len + 1) /* bControlSize */
8787
return false;
8888
m = hdr[len];
8989
len += 1 + m + 1; /* bControlSize, bmControls, iProcessing */

0 commit comments

Comments
 (0)