USB: serial: ftdi_sio: fix break and sysrq handling
authorJohan Hovold <johan@kernel.org>
Wed, 8 Jul 2020 12:49:53 +0000 (14:49 +0200)
committerJohan Hovold <johan@kernel.org>
Thu, 9 Jul 2020 07:19:45 +0000 (09:19 +0200)
commit733fff67941dad64b8a630450b8372b1873edc41
treea62c1e7ed9d9c9bf1c0e8b863a86677b910a0656
parentce054039ba5e47b75a3be02a00274e52b06a6456
USB: serial: ftdi_sio: fix break and sysrq handling

Only the last NUL in a packet should be flagged as a break character,
for example, to avoid dropping unrelated characters when IGNBRK is set.

Also make sysrq work by consuming the break character instead of having
it immediately cancel the sysrq request, and by not processing it
prematurely to avoid triggering a sysrq based on an unrelated character
received in the same packet (which was received *before* the break).

Note that the break flag can be left set also for a packet received
immediately following a break and that and an ending NUL in such a
packet will continue to be reported as a break as there's no good way to
tell it apart from an actual break.

Tested on FT232R and FT232H.

Fixes: 72fda3ca6fc1 ("USB: serial: ftd_sio: implement sysrq handling on break")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/ftdi_sio.c