Skip to content

Commit 410534a

Browse files
jhovoldgregkh
authored andcommitted
USB: serial: kobil_sct: fix modem-status error handling
[ Upstream commit a420b5d ] Make sure to return -EIO in case of a short modem-status read request. While at it, split the debug message to not include the (zeroed) transfer-buffer content in case of errors. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 90de568 commit 410534a

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

drivers/usb/serial/kobil_sct.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,20 @@ static int kobil_tiocmget(struct tty_struct *tty)
397397
transfer_buffer_length,
398398
KOBIL_TIMEOUT);
399399

400-
dev_dbg(&port->dev, "%s - Send get_status_line_state URB returns: %i. Statusline: %02x\n",
401-
__func__, result, transfer_buffer[0]);
400+
dev_dbg(&port->dev, "Send get_status_line_state URB returns: %i\n",
401+
result);
402+
if (result < 1) {
403+
if (result >= 0)
404+
result = -EIO;
405+
goto out_free;
406+
}
407+
408+
dev_dbg(&port->dev, "Statusline: %02x\n", transfer_buffer[0]);
402409

403410
result = 0;
404411
if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0)
405412
result = TIOCM_DSR;
413+
out_free:
406414
kfree(transfer_buffer);
407415
return result;
408416
}

0 commit comments

Comments
 (0)