diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-10-10 06:32:56 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-10-11 10:59:27 -0400 |
commit | 5935b9526a5e92e294397be8a1253c2a17d97204 (patch) | |
tree | 1f9c2e9f747b902e2b069baa0b974a04c0b56a5c | |
parent | 1f10034938e7e1aa787a683cb56cdee3595f29b4 (diff) |
ALSA: hiface: Add sanity checks for invalid EPs
hiface usb-audio driver sets up URBs containing the fixed endpoints
without validation. This may end up with an oops-like kernel warning
when submitted.
For avoiding it, this patch adds the calls of the new sanity-check
helper for URBs.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/usb/hiface/pcm.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/usb/hiface/pcm.c b/sound/usb/hiface/pcm.c index 175d8d6b7f59..396c317115b1 100644 --- a/sound/usb/hiface/pcm.c +++ b/sound/usb/hiface/pcm.c | |||
@@ -541,6 +541,8 @@ static int hiface_pcm_init_urb(struct pcm_urb *urb, | |||
541 | usb_fill_bulk_urb(&urb->instance, chip->dev, | 541 | usb_fill_bulk_urb(&urb->instance, chip->dev, |
542 | usb_sndbulkpipe(chip->dev, ep), (void *)urb->buffer, | 542 | usb_sndbulkpipe(chip->dev, ep), (void *)urb->buffer, |
543 | PCM_PACKET_SIZE, handler, urb); | 543 | PCM_PACKET_SIZE, handler, urb); |
544 | if (usb_urb_ep_type_check(&urb->instance)) | ||
545 | return -EINVAL; | ||
544 | init_usb_anchor(&urb->submitted); | 546 | init_usb_anchor(&urb->submitted); |
545 | 547 | ||
546 | return 0; | 548 | return 0; |
@@ -599,9 +601,12 @@ int hiface_pcm_init(struct hiface_chip *chip, u8 extra_freq) | |||
599 | mutex_init(&rt->stream_mutex); | 601 | mutex_init(&rt->stream_mutex); |
600 | spin_lock_init(&rt->playback.lock); | 602 | spin_lock_init(&rt->playback.lock); |
601 | 603 | ||
602 | for (i = 0; i < PCM_N_URBS; i++) | 604 | for (i = 0; i < PCM_N_URBS; i++) { |
603 | hiface_pcm_init_urb(&rt->out_urbs[i], chip, OUT_EP, | 605 | ret = hiface_pcm_init_urb(&rt->out_urbs[i], chip, OUT_EP, |
604 | hiface_pcm_out_urb_handler); | 606 | hiface_pcm_out_urb_handler); |
607 | if (ret < 0) | ||
608 | return ret; | ||
609 | } | ||
605 | 610 | ||
606 | ret = snd_pcm_new(chip->card, "USB-SPDIF Audio", 0, 1, 0, &pcm); | 611 | ret = snd_pcm_new(chip->card, "USB-SPDIF Audio", 0, 1, 0, &pcm); |
607 | if (ret < 0) { | 612 | if (ret < 0) { |