]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit82dc332c4710f53a2525df8bbe425583131c05d1
tree14971e36fed1195c07ea895061b15ad84f98f665
parentc26c6b85fed8f5050e34238e2262f68ac63b63df
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: 696935b783a6 ("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