diff options
author | Shuah Khan <shuahkh@osg.samsung.com> | 2017-12-07 14:16:50 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-20 10:10:19 +0100 |
commit | d78a5506cf0ea112124c1ffa5c0aae09b579d96d (patch) | |
tree | a83dab7f7c15efea8e9fdbe7c92b1d2740aa101c | |
parent | b6a2ad646c13bb9d1231bce5599cb3176ff33ca4 (diff) | |
download | linux-stable-d78a5506cf0ea112124c1ffa5c0aae09b579d96d.tar.gz linux-stable-d78a5506cf0ea112124c1ffa5c0aae09b579d96d.tar.bz2 linux-stable-d78a5506cf0ea112124c1ffa5c0aae09b579d96d.zip |
usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer
commit be6123df1ea8f01ee2f896a16c2b7be3e4557a5a upstream.
stub_send_ret_submit() handles urb with a potential null transfer_buffer,
when it replays a packet with potential malicious data that could contain
a null buffer. Add a check for the condition when actual_length > 0 and
transfer_buffer is null.
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>
-rw-r--r-- | drivers/usb/usbip/stub_tx.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/usbip/stub_tx.c b/drivers/usb/usbip/stub_tx.c index be50cef645d8..87ff94be4235 100644 --- a/drivers/usb/usbip/stub_tx.c +++ b/drivers/usb/usbip/stub_tx.c @@ -181,6 +181,13 @@ static int stub_send_ret_submit(struct stub_device *sdev) memset(&pdu_header, 0, sizeof(pdu_header)); memset(&msg, 0, sizeof(msg)); + if (urb->actual_length > 0 && !urb->transfer_buffer) { + dev_err(&sdev->udev->dev, + "urb: actual_length %d transfer_buffer null\n", + urb->actual_length); + return -1; + } + if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) iovnum = 2 + urb->number_of_packets; else |