In the Linux kernel, the following vulnerability has been resolved:
powerpc/iommu: Fix notifiers being shared by PCI and VIO buses
failiommusetup() registers the failiommubusnotifier struct to both PCI and VIO buses. struct notifierblock is a linked list node, so this causes any notifiers later registered to either bus type to also be registered to the other since they share the same node.
This causes issues in (at least) the vgaarb code, which registers a notifier for PCI buses. pcinotify() ends up being called on a vio device, converted with topcidev() even though it's not a PCI device, and finally makes a bad access in vgaarbiteraddpci_device() as discovered with KASAN:
BUG: KASAN: slab-out-of-bounds in vgaarbiteraddpcidevice+0x60/0xe00 Read of size 4 at addr c000000264c26fdc by task swapper/0/1
Call Trace: dumpstacklvl+0x1bc/0x2b8 (unreliable) printreport+0x3f4/0xc60 kasanreport+0x244/0x698 _asanload4+0xe8/0x250 vgaarbiteraddpcidevice+0x60/0xe00 pcinotify+0x88/0x444 notifiercallchain+0x104/0x320 blockingnotifiercallchain+0xa0/0x140 deviceadd+0xac8/0x1d30 deviceregister+0x58/0x80 vioregisterdevicenode+0x9ac/0xce0 viobusscanregisterdevices+0xc4/0x13c _machineinitcallpseriesviodeviceinit+0x94/0xf0 dooneinitcall+0x12c/0xaa8 kernelinitfreeable+0xa48/0xba8 kernelinit+0x64/0x400 retfromkernel_thread+0x5c/0x64
Fix this by creating separate notifier_block structs for each bus type.
[mpe: Add #ifdef to fix CONFIG_IBMVIO=n build]
{
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/54xxx/CVE-2023-54095.json",
"cna_assigner": "Linux"
}