mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-19 02:54:00 +08:00
usbip: vudc_tx: fix v_send_ret_submit() vulnerability to null xfer buffer
v_send_ret_submit() handles urb with a 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> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e1346fd87c
commit
5fd77a3a0e
@ -85,6 +85,13 @@ static int v_send_ret_submit(struct vudc *udc, struct urbp *urb_p)
|
|||||||
memset(&pdu_header, 0, sizeof(pdu_header));
|
memset(&pdu_header, 0, sizeof(pdu_header));
|
||||||
memset(&msg, 0, sizeof(msg));
|
memset(&msg, 0, sizeof(msg));
|
||||||
|
|
||||||
|
if (urb->actual_length > 0 && !urb->transfer_buffer) {
|
||||||
|
dev_err(&udc->gadget.dev,
|
||||||
|
"urb: actual_length %d transfer_buffer null\n",
|
||||||
|
urb->actual_length);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (urb_p->type == USB_ENDPOINT_XFER_ISOC)
|
if (urb_p->type == USB_ENDPOINT_XFER_ISOC)
|
||||||
iovnum = 2 + urb->number_of_packets;
|
iovnum = 2 + urb->number_of_packets;
|
||||||
else
|
else
|
||||||
@ -100,8 +107,8 @@ static int v_send_ret_submit(struct vudc *udc, struct urbp *urb_p)
|
|||||||
|
|
||||||
/* 1. setup usbip_header */
|
/* 1. setup usbip_header */
|
||||||
setup_ret_submit_pdu(&pdu_header, urb_p);
|
setup_ret_submit_pdu(&pdu_header, urb_p);
|
||||||
usbip_dbg_stub_tx("setup txdata seqnum: %d urb: %p\n",
|
usbip_dbg_stub_tx("setup txdata seqnum: %d\n",
|
||||||
pdu_header.base.seqnum, urb);
|
pdu_header.base.seqnum);
|
||||||
usbip_header_correct_endian(&pdu_header, 1);
|
usbip_header_correct_endian(&pdu_header, 1);
|
||||||
|
|
||||||
iov[iovnum].iov_base = &pdu_header;
|
iov[iovnum].iov_base = &pdu_header;
|
||||||
|
Loading…
Reference in New Issue
Block a user