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 <oneukum@suse.com>
Reported-and-tested-by: syzbot+d29e9263e13ce0b9f4fd@syzkaller.appspotmail.com
Fixes: 1da177e4c3
("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
This commit is contained in:
Родитель
ae83d0b416
Коммит
e9b3c610a0
|
@ -1138,8 +1138,8 @@ static void garmin_read_process(struct garmin_data *garmin_data_p,
|
||||||
send it directly to the tty port */
|
send it directly to the tty port */
|
||||||
if (garmin_data_p->flags & FLAGS_QUEUING) {
|
if (garmin_data_p->flags & FLAGS_QUEUING) {
|
||||||
pkt_add(garmin_data_p, data, data_length);
|
pkt_add(garmin_data_p, data, data_length);
|
||||||
} else if (bulk_data ||
|
} else if (bulk_data || (data_length >= sizeof(u32) &&
|
||||||
getLayerId(data) == GARMIN_LAYERID_APPL) {
|
getLayerId(data) == GARMIN_LAYERID_APPL)) {
|
||||||
|
|
||||||
spin_lock_irqsave(&garmin_data_p->lock, flags);
|
spin_lock_irqsave(&garmin_data_p->lock, flags);
|
||||||
garmin_data_p->flags |= APP_RESP_SEEN;
|
garmin_data_p->flags |= APP_RESP_SEEN;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче