CVE-2026-89722: PCI/sysfs: Fix out-of-bounds read in pci_write_legacy_io()

Published Sep 11, 2026
·
Updated

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

PCI/sysfs: Fix out-of-bounds read in pciwritelegacyio()

pciwritelegacyio() loads 4 bytes from the kernfs write buffer regardless of how many bytes userspace wrote:

if (count != 1 && count != 2 && count != 4) return -EINVAL;

return pcilegacywrite(bus, off, (u32 )buf, count);

kernfsfopwriteiter() allocates the buffer with kmalloc(len + 1), so a 1-byte write to the legacyio sysfs file allocates 2 bytes and the unconditional u32 load reads up to 2 bytes past the end of the allocation, which KASAN reports as a slab-out-of-bounds read. Similarly, a 2-byte write overreads by 1 byte.

Thus, read only the number of bytes requested using getunalignedle16() and getunalignedle32() for the 2 and 4 byte cases, interpreting the buffer as little-endian to match the byte ordering of PCI I/O port space.

The PowerPC implementation previously compensated for the generic code's native-endian 32-bit load by shifting the value into place for the 1 and 2 byte cases. The shifts were only correct on big-endian kernels.

On little-endian PowerPC (POWER8 and later), they extracted the wrong bytes, so a 1-byte write wrote an out-of-bounds byte instead of the requested value. On big-endian, the native load also caused outle16() and outle32() to reverse the user's bytes on the wire for 2 and 4 byte writes. The little-endian helpers resolve both issues, so the shifts are removed.

No changes are needed for the Alpha platform.

The legacyio file is root-only and exists only on Alpha and PowerPC, the two architectures that define HAVEPCILEGACY.

Affected Software

1 affected component
Linux Linux kernel

Event History

Sep 11, 2026
CVE Published
via MITRE·07:46 PM
Data Sourced
via MITRE·07:46 PM
Description

Frequently Asked Questions

1

What access would an attacker need to trigger the out-of-bounds read?

They would need to be able to write to the PCI bus legacy_io sysfs file. The overread is triggered by a 1-byte or 2-byte write; 4-byte writes do not have this specific short-buffer condition.

2

How can I tell whether the issue is occurring on a system under test?

KASAN can report the condition as a slab-out-of-bounds read when pci_write_legacy_io() handles a short write to legacy_io. A 1-byte write reads up to 2 bytes beyond the allocation, while a 2-byte write reads 1 byte beyond it.

3

Is there a separate functional impact on PowerPC systems?

Yes. On little-endian PowerPC systems, including POWER8 and later, the prior handling of 1-byte and 2-byte writes could select the wrong bytes and write an unintended value to PCI I/O port space.

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