linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] garmin_gps: add sanity checking for data length
@ 2020-04-15 14:03 Oliver Neukum
  2020-04-22  7:14 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2020-04-15 14:03 UTC (permalink / raw)
  To: johan, gregkh, linux-usb; +Cc: Oliver Neukum

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
---
 drivers/usb/serial/garmin_gps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index ffd984142171..a72fbbc65436 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1138,8 +1138,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;
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] garmin_gps: add sanity checking for data length
  2020-04-15 14:03 [PATCH] garmin_gps: add sanity checking for data length Oliver Neukum
@ 2020-04-22  7:14 ` Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2020-04-22  7:14 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: johan, gregkh, linux-usb

On Wed, Apr 15, 2020 at 04:03:04PM +0200, Oliver Neukum wrote:
> 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

Applied with a Fixes and CC-stable tag as technically this is a
minuscule slab info leak.

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-22  7:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-15 14:03 [PATCH] garmin_gps: add sanity checking for data length Oliver Neukum
2020-04-22  7:14 ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).