From: Shuah Khan <shuahkh@osg.samsung.com>
To: shuah@kernel.org, valentina.manea.m@gmail.com,
gregkh@linuxfoundation.org
Cc: Shuah Khan <shuahkh@osg.samsung.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer
Date: Thu, 7 Dec 2017 14:16:50 -0700 [thread overview]
Message-ID: <9adf1dc258e47ffee320ce479e0eb76f4f3d5712.1512672005.git.shuahkh@osg.samsung.com> (raw)
In-Reply-To: <cover.1512672005.git.shuahkh@osg.samsung.com>
In-Reply-To: <cover.1512672005.git.shuahkh@osg.samsung.com>
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.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
drivers/usb/usbip/stub_tx.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/usb/usbip/stub_tx.c b/drivers/usb/usbip/stub_tx.c
index b18bce96c212..53172b1f6257 100644
--- a/drivers/usb/usbip/stub_tx.c
+++ b/drivers/usb/usbip/stub_tx.c
@@ -167,6 +167,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
--
2.14.1
next prev parent reply other threads:[~2017-12-07 21:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 21:16 [PATCH 0/4] USB over IP Secuurity fixes Shuah Khan
2017-12-07 21:16 ` [PATCH 1/4] usbip: fix stub_rx: get_pipe() to validate endpoint number Shuah Khan
2017-12-07 21:16 ` [PATCH 2/4] usbip: fix stub_rx: harden CMD_SUBMIT path to handle malicious input Shuah Khan
2017-12-07 21:16 ` [PATCH 3/4] usbip: prevent vhci_hcd driver from leaking a socket pointer address Shuah Khan
2017-12-07 21:16 ` Shuah Khan [this message]
2017-12-08 6:25 ` [PATCH 0/4] USB over IP Secuurity fixes Greg KH
2017-12-08 15:41 ` Shuah Khan
2017-12-08 15:14 ` Secunia Research
2017-12-08 15:44 ` Shuah Khan
2017-12-08 16:33 ` Greg KH
2017-12-08 16:41 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9adf1dc258e47ffee320ce479e0eb76f4f3d5712.1512672005.git.shuahkh@osg.samsung.com \
--to=shuahkh@osg.samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=valentina.manea.m@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).