usbip: fix stub_rx: get_pipe() to validate endpoint number
authorShuah Khan <shuahkh@osg.samsung.com>
Thu, 7 Dec 2017 21:16:47 +0000 (14:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2017 09:10:19 +0000 (10:10 +0100)
commit7120d742ad8d0f1fe37e4b73827e166fc1e01eea
treeafb457ea5daf4112293857298afc19f66c3983a0
parentcb6ee0f3c19980328529d5ed7a1650e41164ca49
usbip: fix stub_rx: get_pipe() to validate endpoint number

commit 635f545a7e8be7596b9b2b6a43cab6bbd5a88e43 upstream.

get_pipe() routine doesn't validate the input endpoint number
and uses to reference ep_in and ep_out arrays. Invalid endpoint
number can trigger BUG(). Range check the epnum and returning
error instead of calling BUG().

Change caller stub_recv_cmd_submit() to handle the get_pipe()
error return.

Reported-by: Secunia Research <vuln@secunia.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/usbip/stub_rx.c