aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/serial/safe_serial.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2017-03-20 12:03:13 +0800
committerAlex Shi <alex.shi@linaro.org>2017-03-20 12:03:13 +0800
commit89e7fad96be88f30f491bf227d864bf5e8e701b2 (patch)
tree6316161ebd26b780991ff8632471fbbfa3af7ea8 /drivers/usb/serial/safe_serial.c
parent5b0250d2571ee75ca3c0b34579c3e90bc2bd9c6a (diff)
parent1c563c0006661025d7a6c9bc85fc889a4e8a1c06 (diff)
Diffstat (limited to 'drivers/usb/serial/safe_serial.c')
-rw-r--r--drivers/usb/serial/safe_serial.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
index b2dff0f14743..236ea43f7815 100644
--- a/drivers/usb/serial/safe_serial.c
+++ b/drivers/usb/serial/safe_serial.c
@@ -205,6 +205,11 @@ static void safe_process_read_urb(struct urb *urb)
if (!safe)
goto out;
+ if (length < 2) {
+ dev_err(&port->dev, "malformed packet\n");
+ return;
+ }
+
fcs = fcs_compute10(data, length, CRC10_INITFCS);
if (fcs) {
dev_err(&port->dev, "%s - bad CRC %x\n", __func__, fcs);