[SRU][Trusty][PATCH 1/1] usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer

Kleber Sacilotto de Souza kleber.souza at canonical.com
Tue Jul 24 11:28:04 UTC 2018


From: Shuah Khan <shuahkh at 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.

Reported-by: Secunia Research <vuln at secunia.com>
Cc: stable <stable at vger.kernel.org>
Signed-off-by: Shuah Khan <shuahkh at osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>

CVE-2017-16914
(backported from commit be6123df1ea8f01ee2f896a16c2b7be3e4557a5a)
[ klebers: adjusted the file path, the usbip is still under staging on
  kernel 3.13. ]
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza at canonical.com>
---
 drivers/staging/usbip/stub_tx.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/usbip/stub_tx.c b/drivers/staging/usbip/stub_tx.c
index cd5326ae38cc..570713533a1f 100644
--- a/drivers/staging/usbip/stub_tx.c
+++ b/drivers/staging/usbip/stub_tx.c
@@ -173,6 +173,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.17.1





More information about the kernel-team mailing list