CVE-2026-142971: USB: serial: garmin_gps: validate packet data length in nat_receive()

Published Dec 3, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

USB: serial: garmingps: validate packet data length in natreceive()

In natreceive() (called from garminwrite() when userspace writes to /dev/ttyUSBn in MODENATIVE mode), while garmindatap->insize is less than GARMINPKTHDRLENGTH (12), the loop copies up to 12 bytes into garmindatap->inbuffer. Once garmindatap->insize reaches GARMINPKTHDRLENGTH, natreceive() computes the total packet size as:

len = GARMINPKTHDRLENGTH + getDataLength(garmindatap->inbuffer);

Because getDataLength() returns a signed int from le32tocpup(), a 12-byte header with a negative 32-bit length field (such as 0xfffffff5, i.e., -11) causes len to underflow to a small positive value (12 + (-11) = 1) without any bounds check at that point. Then garmindatap->insize = len (12 >= 1) evaluates to true and natreceive() calls garminwritebulk(port, inbuffer, 1, 0), which allocates a 1-byte slab buffer via kmemdup() and immediately reads 4 bytes from it in getLayerId(buffer) (and again in garminwritebulkcallback() when the URB completes):

BUG: KASAN: slab-out-of-bounds in garminwritebulk.constprop.0+0x3eb/0x500 Read of size 4 at addr ffff888002cc0ba0 by task init/1 Call Trace: <TASK> dumpstacklvl+0x70/0xa0 printreport+0x153/0x4c6 kasanreport+0xf1/0x120 garminwritebulk.constprop.0+0x3eb/0x500 garminwrite+0x60f/0x1450 serialwrite+0x123/0x200 nttywrite+0x8ea/0xeb0 filettywrite.isra.0+0x44f/0x7a0 vfswrite+0x671/0xd20

Validate the unsigned 32-bit data length (dlen >= GPSINBUFSIZ - GARMINPKTHDRLENGTH, matching the existing len >= GPSINBUFSIZ bound) in natreceive() as soon as the 12-byte header is present, resetting insize and returning -EINVPKT on invalid lengths so garminwritebulk() is only ever called with a full valid packet header (12 <= len < GPSINBUFSIZ).

Tested in QEMU against Linux 7.3.0-rc3 by emulating a Garmin USB GPS device (091e:0003) via dummyhcd + raw-gadget, switching /dev/ttyUSB0 to MODENATIVE via PRIVPKTIDSETMODE, and writing a 12-byte native packet with data length 0xfffffff5: on the unfixed kernel this triggers KASAN slab-out-of-bounds reads in garminwritebulk() and garminwritebulkcallback(), whereas on the fixed kernel natreceive() rejects the packet with -EINVPKT and 0 KASAN faults.

[ johan: move comment and devdbg(); add comment about redundant check ]

Affected Software

1 affected component
Linux Linux kernel

Event History

Dec 3, 2026
CVE Published
via MITRE·09:17 AM
Data Sourced
via MITRE·09:17 AM
Description

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203