summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/garmin_gps.c
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.com>2020-04-15 17:03:04 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-20 09:15:27 +0300
commit567299fef491d0d4033e5093424dc21835e1825d (patch)
tree54a25e25daf9299f2096b6b4dd4ea321da7c3972 /drivers/usb/serial/garmin_gps.c
parenta8c9cebed0d47a0dcd7075418969e691521fa1c4 (diff)
downloadlinux-567299fef491d0d4033e5093424dc21835e1825d.tar.xz
USB: serial: garmin_gps: add sanity checking for data length
commit e9b3c610a05c1cdf8e959a6d89c38807ff758ee6 upstream. We must not process packets shorter than a packet ID Signed-off-by: Oliver Neukum <oneukum@suse.com> Reported-and-tested-by: syzbot+d29e9263e13ce0b9f4fd@syzkaller.appspotmail.com Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable <stable@vger.kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/garmin_gps.c')
-rw-r--r--drivers/usb/serial/garmin_gps.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 91e7e3a166a5..c67a17faaa3c 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1161,8 +1161,8 @@ static void garmin_read_process(struct garmin_data *garmin_data_p,
send it directly to the tty port */
if (garmin_data_p->flags & FLAGS_QUEUING) {
pkt_add(garmin_data_p, data, data_length);
- } else if (bulk_data ||
- getLayerId(data) == GARMIN_LAYERID_APPL) {
+ } else if (bulk_data || (data_length >= sizeof(u32) &&
+ getLayerId(data) == GARMIN_LAYERID_APPL)) {
spin_lock_irqsave(&garmin_data_p->lock, flags);
garmin_data_p->flags |= APP_RESP_SEEN;