DragonFlyBSD Kernel Audit
← triage · dashboard
DF-2210

Unconditional NULL dereference of ch->dma in ata_national_setmode panics kernel when DMA unavailable

Summary

ata_national_setmode unconditionally dereferences ch->dma->alignment and ch->dma->max_iosize at lines 77-78 before any mode negotiation or resource check. ch->dma pointer is NULL whenever PCI busmastering unavailable (ctlr->dmainit never set per ata-pci.c:217-223 BUSMASTEREN bit does not stick) or DMA tag/map allocation fails (ata-dma.c:149-153 sets ch->dma=NULL on error). When any ATA device on channel subsequently configured at boot probe via ad_init/acd_attach or at runtime via IOCATASMODE ioctl (ata-all.c:523-526) or acd_open (atapi-cd.c:226) NULL dereference causes immediate kernel page-fault panic. National driver is documented clone of Cyrix driver (comment line 39) Cyrix original guards this access inside if(ctlr->r_res1) (ata-cyrix.c:84) National dropped that guard. Trigger: local user on system with SC1100 (PCI ID 0x0502100b) ATA controller or VM admin controlling virtual PCI device command register/DMA capabilities. Impact: immediate kernel panic NULL page fault local DoS. Two models: (a) deterministic boot system/VM where SC1100 PCI command register lacks BUSMASTEREN hardwired 0 attach virtual disk panic at probe; (b) probabilistic induce memory pressure cause ata_dmaalloc failure trigger re-probe via IOCATAATTACH or open /dev/acd0.

Discussion (0)

No comments yet.