CVE-2026-139392: lib: validate in-memory LZ4 chunk length
In the Linux kernel, the following vulnerability has been resolved:
lib: validate in-memory LZ4 chunk length
We found and validated an issue in lib/decompressunlz4.c. The bug is reachable by a root user through kexecfileload() with a crafted external initrd.
unlz4() reads the compressed chunk length from an in-memory initrd and passes it to LZ4decompresssafe(). It only checks the chunk length against the allocation size when the input is filled by a callback.
Reject an in-memory chunk that extends past the remaining input before calling the LZ4 decoder. This prevents malformed initrds from making the decoder read past the mapped archive.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In lib/decompress_unlz4.c, reject an in-memory LZ4 chunk whose length exceeds the remaining input or allocation size before passing it to LZ4_decompress_safe().
Event History
Frequently Asked Questions
Who can realistically exploit this issue?
The described path is reachable by a root user who invokes kexec_file_load() with a crafted external initrd. The provided information does not indicate that an unprivileged local user or remote attacker can reach it directly.
What must an attacker control to trigger the out-of-bounds read?
They need to supply an external initrd containing an in-memory LZ4 chunk whose declared compressed length extends beyond the remaining archive input. The vulnerable code passes that length to LZ4_decompress_safe() without validating it for the in-memory input path.
What is the effect of the fix?
The fix rejects an in-memory LZ4 chunk when its length exceeds the remaining input before invoking the LZ4 decoder. This prevents the decoder from reading beyond the mapped archive.