OSDN Git Service

USB: serial: cp210x: fix dropped characters with CP2102
authorJohan Hovold <johan@kernel.org>
Wed, 22 Sep 2021 11:30:59 +0000 (13:30 +0200)
committerJohan Hovold <johan@kernel.org>
Thu, 23 Sep 2021 08:44:46 +0000 (10:44 +0200)
commitc32dfec6c1c36bbbcd5d33e949d99aeb215877ec
tree14971e36fed1195c07ea895061b15ad84f98f665
parent1ca200a8c6f079950a04ea3c3380fe8cf78e95a2
USB: serial: cp210x: fix dropped characters with CP2102

Some CP2102 do not support event-insertion mode but return no error when
attempting to enable it.

This means that any event escape characters in the input stream will not
be escaped by the device and consequently regular data may be
interpreted as escape sequences and be removed from the stream by the
driver.

The reporter's device has batch number DCL00X etched into it and as
discovered by the SHA2017 Badge team, counterfeit devices with that
marking can be detected by sending malformed vendor requests. [1][2]

Tests confirm that the possibly counterfeit CP2102 returns a single byte
in response to a malformed two-byte part-number request, while an
original CP2102 returns two bytes. Assume that every CP2102 that behaves
this way also does not support event-insertion mode (e.g. cannot report
parity errors).

[1] https://mobile.twitter.com/sha2017badge/status/1167902087289532418
[2] https://hackaday.com/2017/08/14/hands-on-with-the-shacamp-2017-badge/#comment-3903376

Reported-by: Malte Di Donato <malte@neo-soft.org>
Tested-by: Malte Di Donato <malte@neo-soft.org>
Fixes: a7207e9835a4 ("USB: serial: cp210x: add support for line-status events")
Cc: stable@vger.kernel.org # 5.9
Link: https://lore.kernel.org/r/20210922113100.20888-1-johan@kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/cp210x.c