Patch "USB: serial: digi_acceleport: fix incomplete rx sanity check" has been added to the 4.9-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
USB: serial: digi_acceleport: fix incomplete rx sanity check
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
usb-serial-digi_acceleport-fix-incomplete-rx-sanity-check.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
1b0aed2b1600f6e5c7b9acfbd610a4e351ef5232Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Tue, 31 Jan 2017 17:17:28 +0100
Subject: USB: serial: digi_acceleport: fix incomplete rx sanity check
From: Johan Hovold <[email protected]>
commit 1b0aed2b1600f6e5c7b9acfbd610a4e351ef5232 upstream.
Make sure the received data has the required headers before parsing it.
Also drop the redundant urb-status check, which has already been handled by the caller.
--- drivers/usb/serial/digi_acceleport.c | 38 +++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-)
drivers/usb/serial/digi_acceleport.c +23 -15
@@ -1398,25 +1398,30 @@ static int digi_read_inb_callback(struct {struct usb_serial_port *port = urb->context;struct digi_port *priv =usb_get_serial_port_data (port); -int opcode = ((unsigned char *)urb->transfer_buffer)[0 ]; -int len = ((unsigned char *)urb->transfer_buffer)[1 ]; -int port_status = ((unsigned char *)urb->transfer_buffer)[2 ]; -unsigned char *data = ((unsigned char *)urb->transfer_buffer) +3 ; +unsigned char *buf = urb->transfer_buffer; +int opcode; +int len; +int port_status; +unsigned char *data;int flag, throttled; -int status = urb->status; - -/* do not process callbacks on closed ports */ -/* but do continue the read chain */ -if (urb->status == -ENOENT ) -return 0 ;/* short/multiple packet check */ +if (urb->actual_length <2 ) { +dev_warn (&port->dev,"short packet received\n" ); +return -1 ; + } + + opcode = buf[0 ]; + len = buf[1 ]; +if (urb->actual_length != len +2 ) { -dev_err (&port->dev,"%s: INCOMPLETE OR MULTIPLE PACKET, " -"status=%d, port=%d, opcode=%d, len=%d, " -"actual_length=%d, status=%d\n" , __func__, status, - priv->dp_port_num, opcode, len, urb->actual_length, - port_status); +dev_err (&port->dev,"malformed packet received: port=%d, opcode=%d, len=%d, actual_length=%u\n" , + priv->dp_port_num, opcode, len, urb->actual_length); +return -1 ; + } + +if (opcode ==DIGI_CMD_RECEIVE_DATA && len <1 ) { +dev_err (&port->dev,"malformed data packet received\n" );return -1 ; }
@@ -1430,6 +1435,9 @@ static int digi_read_inb_callback(struct/* receive data */ if (opcode ==DIGI_CMD_RECEIVE_DATA ) { + port_status = buf[2 ]; + data = &buf[3 ]; +/* get flag from port_status */ flag =0 ;
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/usb-serial-mct_u232-fix-modem-status-error-handling.patch queue-4.9/usb-serial-ark3116-fix-open-error-handling.patch queue-4.9/usb-serial-io_edgeport-fix-epic-descriptor-handling.patch queue-4.9/usb-serial-ti_usb_3410_5052-fix-control-message-error-handling.patch queue-4.9/usb-serial-keyspan_pda-fix-receive-sanity-checks.patch queue-4.9/usb-serial-sierra-fix-bogus-alternate-setting-assumption.patch queue-4.9/usb-serial-ssu100-fix-control-message-error-handling.patch queue-4.9/usb-serial-digi_acceleport-fix-incomplete-rx-sanity-check.patch queue-4.9/usb-serial-io_edgeport-fix-descriptor-error-handling.patch queue-4.9/usb-serial-quatech2-fix-control-message-error-handling.patch queue-4.9/usb-serial-ftdi_sio-fix-latency-timer-error-handling.patch