Skip to content

Commit e9b3c61

Browse files
oneukumjhovold
authored andcommitted
USB: serial: garmin_gps: add sanity checking for data length
We must not process packets shorter than a packet ID Signed-off-by: Oliver Neukum <[email protected]> Reported-and-tested-by: [email protected] Fixes: 1da177e ("Linux-2.6.12-rc2") Cc: stable <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
1 parent ae83d0b commit e9b3c61

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/usb/serial/garmin_gps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,8 +1138,8 @@ static void garmin_read_process(struct garmin_data *garmin_data_p,
11381138
send it directly to the tty port */
11391139
if (garmin_data_p->flags & FLAGS_QUEUING) {
11401140
pkt_add(garmin_data_p, data, data_length);
1141-
} else if (bulk_data ||
1142-
getLayerId(data) == GARMIN_LAYERID_APPL) {
1141+
} else if (bulk_data || (data_length >= sizeof(u32) &&
1142+
getLayerId(data) == GARMIN_LAYERID_APPL)) {
11431143

11441144
spin_lock_irqsave(&garmin_data_p->lock, flags);
11451145
garmin_data_p->flags |= APP_RESP_SEEN;

0 commit comments

Comments
 (0)