summaryrefslogtreecommitdiffstats
path: root/sound/usb/caiaq/device.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-10-11 16:59:40 +0200
committerTakashi Iwai <tiwai@suse.de>2017-10-11 17:00:08 +0200
commit8ed5d192c0beb34c9a679b390c2e4077ae977dc2 (patch)
tree4719ad90a3a5fd8c47fd108aae9dff61e3ddb904 /sound/usb/caiaq/device.c
parentALSA: seq: Add sanity check for user-space pointer delivery (diff)
parentALSA: line6: Add yet more sanity checks for invalid EPs (diff)
downloadlinux-8ed5d192c0beb34c9a679b390c2e4077ae977dc2.tar.xz
linux-8ed5d192c0beb34c9a679b390c2e4077ae977dc2.zip
Merge branch 'topic/usb-ep-check-v2' into for-next
Pulling the EP validity checks in USB audio drivers. It also adds a new helper in USB core, which was acked by Greg. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/caiaq/device.c')
-rw-r--r--sound/usb/caiaq/device.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c
index 0fb6b1b79261..a29674bf96e5 100644
--- a/sound/usb/caiaq/device.c
+++ b/sound/usb/caiaq/device.c
@@ -461,6 +461,13 @@ static int init_card(struct snd_usb_caiaqdev *cdev)
cdev->midi_out_buf, EP1_BUFSIZE,
snd_usb_caiaq_midi_output_done, cdev);
+ /* sanity checks of EPs before actually submitting */
+ if (usb_urb_ep_type_check(&cdev->ep1_in_urb) ||
+ usb_urb_ep_type_check(&cdev->midi_out_urb)) {
+ dev_err(dev, "invalid EPs\n");
+ return -EINVAL;
+ }
+
init_waitqueue_head(&cdev->ep1_wait_queue);
init_waitqueue_head(&cdev->prepare_wait_queue);