CVE-2026-138947: fs/ntfs3: fix integer overflow in find_log_rec() causing OOB read

Published Nov 30, 2026
·
Updated

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

fs/ntfs3: fix integer overflow in findlogrec() causing OOB read

findlogrec() validates the on-disk LFSRECORDHDR.clientdatalen field (len, a raw u32 read straight from a mounted $LogFile page) against the log's total available space:

len = le32tocpu(rh->clientdatalen); reclen = len + log->recordheaderlen; if (reclen >= log->totalavail) return -EINVAL;

The addition is unchecked. For len in [0xffffffd0, 0xffffffff] (i.e. log->recordheaderlen away from UINTMAX), reclen wraps to a small u32 value that trivially clears the reclen >= log->totalavail guard, so a record whose declared length is actually ~4 GiB is reported as valid and in-page.

Because findlogrec() wrongly accepts the record, its caller readlogreclcb() hands it back to logreplay() as good. On the transaction-table replay leg, logreplay() re-derives the record length directly from the same raw, still-unclamped clientdatalen field and uses it to size the restart-table blob:

reclen = le32tocpu(frh->clientdatalen); / ~0xffffffff / ... t16 = le16tocpu(lrh->redooff); rt = Add2Ptr(lrh, t16); t32 = reclen - t16; / still ~4 GiB / if (!checkrstbl(rt, t32)) return -EINVAL;

checkrstbl()'s own bytes < ts bounds guard is defeated because the caller-supplied bytes (t32) is itself the poisoned ~4 GiB value, so the guard can never trigger. The subsequent entry-validation loop then walks rt->used (also attacker-controlled) entries of sizeof(struct RESTARTTABLE) == 0x18 bytes each straight past the end of the kmalloc(log->pagesize) log-page buffer allocated in readlogpage(), producing an out-of-bounds read that is reachable simply by mounting a crafted $LogFile (no genuine dirty-page / crash-recovery state is required). Confirmed via KASAN as a slab-out-of-bounds read in checkrstbl(), called from logreplay() -> ntfsloadlogandreplay() -> ntfsfillsuper() -> mount(2).

Fix the root cause instead of hardening every downstream consumer of the poisoned length: make the addition in findlogrec() overflow-safe with checkaddoverflow(), mirroring the pattern fs/ntfs3/run.c already uses to validate other attacker-controlled on-disk length/offset arithmetic decoded from MAPPINGPAIRS runs, e.g.:

if (checkaddoverflow(vcn64, len, &nextvcn)) return -EINVAL; ... if (checkaddoverflow(lcn, len, &lcnend)) return -EINVAL;

(fs/ntfs3/run.c, rununpack()).

With the overflow rejected instead of silently wrapped, reclen is only ever a true, non-wrapped sum, so the existing reclen >= log->totalavail check now correctly rejects any oversized record up front. logreplay()'s transaction-table leg then never gets a chance to re-read the poisoned clientdatalen, and checkrstbl() is never invoked with an attacker-inflated bytes for this path.

Verified on a v6.19 KASAN build: mounting a crafted $LogFile whose clientdatalen overflows trips a KASAN slab-out-of-bounds-read report in checkrstbl() before this fix; with checkaddoverflow() applied, the same image is cleanly rejected during log replay and no KASAN report fires.

Event History

Nov 30, 2026
CVE Published
via MITRE·01:26 PM
Data Sourced
via MITRE·01:26 PM
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