Skip to content

Commit 146cc8a

Browse files
committed
USB: serial: kl5kusb105: fix line-state error handling
The current implementation failed to detect short transfers when attempting to read the line state, and also, to make things worse, logged the content of the uninitialised heap transfer buffer. Fixes: abf492e ("USB: kl5kusb105: fix DMA buffers on stack") Fixes: 1da177e ("Linux-2.6.12-rc2") Cc: stable <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
1 parent 55fa15b commit 146cc8a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/usb/serial/kl5kusb105.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,11 @@ static int klsi_105_get_line_state(struct usb_serial_port *port,
192192
status_buf, KLSI_STATUSBUF_LEN,
193193
10000
194194
);
195-
if (rc < 0)
196-
dev_err(&port->dev, "Reading line status failed (error = %d)\n",
197-
rc);
198-
else {
195+
if (rc != KLSI_STATUSBUF_LEN) {
196+
dev_err(&port->dev, "reading line status failed: %d\n", rc);
197+
if (rc >= 0)
198+
rc = -EIO;
199+
} else {
199200
status = get_unaligned_le16(status_buf);
200201

201202
dev_info(&port->serial->dev->dev, "read status %x %x\n",

0 commit comments

Comments
 (0)