DragonFlyBSD Kernel Audit
← triage · dashboard
DF-2223

pcie_capability_read_dword leaves *dst uninitialized on register-not-implemented path diverging from LinuxKPI contract

Summary

pcie_capability_read_dword() returns -EINVAL without writing *dst when pcie_capability_reg_implemented() is false (linux_pci.c:35-36). Upstream Linux instead does *val=0 return 0. LinuxKPI consumers ported from upstream follow upstream convention ignore return value then read *dst unconditionally consuming uninitialized kernel-stack memory. Two live amdgpu call sites affected: pcie_get_width_cap() (pci.h:612) feeding amdgpu_device.c:3550 sets adev->pm.pcie_mlw_mask from uninitialized-derived link_width and amdgpu/cik.c:1634 gates clk_req_support on stale stack bit. Trigger is genuine runtime predicate: pcie_capability_reg_implemented returns false for PCI_EXP_LNKCAP whenever pcie_cap_has_lnkctl() false i.e. for PCIe v1 device whose type is not ROOT_PORT/ENDPOINT/LEG_END (switch upstream/downstream ports PCIe bridges). GPU upstream bridge can be such device on PCIe 1.x systems with discrete GPU behind switch. Impact: incorrect driver behavior potential hardware mis-programming possible local DoS from bad register write. No proven path to arbitrary code execution or direct userspace info leak uninitialized word masked to few bits before use.

Discussion (0)

No comments yet.