Skip to content

drivers: pci: fix EPC MSI IRQ map validation#19324

Merged
jerpelea merged 1 commit into
apache:masterfrom
Old-Ding:codex/pci-epc-map-msi-irq-check
Jul 6, 2026
Merged

drivers: pci: fix EPC MSI IRQ map validation#19324
jerpelea merged 1 commit into
apache:masterfrom
Old-Ding:codex/pci-epc-map-msi-irq-check

Conversation

@Old-Ding

@Old-Ding Old-Ding commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • fix the guard in pci_epc_map_msi_irq() to reject a NULL EPC or missing map_msi_irq callback
  • reject out-of-range endpoint function numbers before invoking the controller op

Why

pci_epc_map_msi_irq() currently uses && between the EPC NULL check and the callback check. That dereferences epc when it is NULL, and it lets a valid EPC with no map_msi_irq callback pass through to a NULL function call.

The surrounding EPC wrappers also validate funcno before dispatching to controller operations, so this helper now follows the same input-validation pattern.

Testing

  • git diff --check origin/master...HEAD
  • git show --stat --check --format=fuller HEAD
  • Not run: local NuttX build, because this Windows workstation does not have the required C build toolchain installed.

pci_epc_map_msi_irq() used && when checking the EPC pointer and map_msi_irq callback. If epc is NULL, the right-hand side dereferences it; if the callback is NULL on a valid EPC, the guard does not reject it before the call.

Match the surrounding EPC wrappers by rejecting a NULL EPC, an out-of-range function number, or a missing map_msi_irq callback before taking the lock and invoking the operation.

Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
@github-actions github-actions Bot added Size: XS The size of the change in this PR is very small Area: PCI labels Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@jerpelea jerpelea merged commit 888711a into apache:master Jul 6, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: PCI Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants