summaryrefslogtreecommitdiffstats
path: root/sound/usb/line6/driver.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-10-10 12:35:46 +0200
committerTakashi Iwai <tiwai@suse.de>2017-10-11 16:59:29 +0200
commit4f95646c803f6a534e58b1d33afbfdaf3e122328 (patch)
tree9d145790711b0dcdabdf2e864fea81a680bd5b4a /sound/usb/line6/driver.c
parent96cd79626fc3fe5d77c243785368679e9b313642 (diff)
downloadtalos-obmc-linux-4f95646c803f6a534e58b1d33afbfdaf3e122328.tar.gz
talos-obmc-linux-4f95646c803f6a534e58b1d33afbfdaf3e122328.zip
ALSA: line6: Add yet more sanity checks for invalid EPs
There are a few other places calling usb_submit_urb() with the URB composed from the fixed endpoint without validation. For avoiding the spurious kernel warnings, add the sanity checks to appropriate places. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/line6/driver.c')
-rw-r--r--sound/usb/line6/driver.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index 0da6f68761e3..7c682b219584 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -175,17 +175,24 @@ static int line6_send_raw_message_async_part(struct message *msg,
}
msg->done += bytes;
- retval = usb_submit_urb(urb, GFP_ATOMIC);
- if (retval < 0) {
- dev_err(line6->ifcdev, "%s: usb_submit_urb failed (%d)\n",
- __func__, retval);
- usb_free_urb(urb);
- kfree(msg);
- return retval;
- }
+ /* sanity checks of EP before actually submitting */
+ retval = usb_urb_ep_type_check(urb);
+ if (retval < 0)
+ goto error;
+
+ retval = usb_submit_urb(urb, GFP_ATOMIC);
+ if (retval < 0)
+ goto error;
return 0;
+
+ error:
+ dev_err(line6->ifcdev, "%s: usb_submit_urb failed (%d)\n",
+ __func__, retval);
+ usb_free_urb(urb);
+ kfree(msg);
+ return retval;
}
/*
OpenPOWER on IntegriCloud