Skip to content

Commit

Permalink
usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer
Browse files Browse the repository at this point in the history
commit be6123d 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>
[bwh: Backported to 3.2:
 - Device for logging purposes is &sdev->interface->dev
 - Adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  • Loading branch information
Shuah Khan authored and Ben Hutchings committed Feb 13, 2018
1 parent 1140602 commit 41ffa4f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/staging/usbip/stub_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,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->interface->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
Expand Down

0 comments on commit 41ffa4f

Please sign in to comment.