Changes in v3:
- Updated cover letter and auto-populated maintainer To/Cc trailers.
- Updated commit formatting per checkpatch guidelines.
- Link to v2:
https://lore.kernel.org/r/[email protected]
PCI/AER: Fix ghes_estatus_pool memory leaks in error handling
This series addresses two memory leaks in PCIe Advanced Error Reporting (AER)
handling where memory snapshot buffers allocated from ghes_estatus_pool
are not released back to the pool.
When firmware reports PCIe errors via ACPI APEI GHES (ghes_handle_aer()), it
allocates a buffer from ghes_estatus_pool for aer_capability_regs and
enqueues it into aer_recover_ring. If errors are dropped or skipped, these
buffers must be freed to prevent ghes_estatus_pool memory exhaustion.
Patch 1: Fixes memory leak in aer_recover_queue() when kfifo_in_spinlocked()
fails due to a buffer overflow (ring capacity of 16 entries full).
Patch 2: Fixes memory leak in aer_recover_work_func() when a dequeued entry
cannot be mapped to a PCI device (pdev is NULL).
Changes in v2:
- Refactored aer_recover_work_func() to ensure ghes_estatus_pool_region_free()
is called unconditionally for every dequeued record.
- Added Patch 2 to fix related memory leak in aer_recover_queue() on
kfifo buffer overflow.
- Updated commit messages with detailed pool lifetime explanations.
Priyank Rathod (2):
PCI/AER: Fix memory leak in aer_recover_queue() on kfifo buffer overflow
PCI/AER: Fix memory leak in aer_recover_work_func() when pci_dev is missing
drivers/pci/pcie/aer.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
Signed-off-by: Priyank Rathod <[email protected]>
---
Changes in v3:
- Updated cover letter and auto-populated maintainer To/Cc trailers.
- Updated commit formatting per checkpatch guidelines.
- Link to v2:
https://lore.kernel.org/r/[email protected]
Changes in v2:
- Refactored aer_recover_work_func() to ensure ghes_estatus_pool_region_free()
is called unconditionally for every dequeued record.
- Added Patch 2 to fix related memory leak in aer_recover_queue() on
kfifo buffer overflow.
- Link to v1:
https://lore.kernel.org/r/[email protected]
---
Priyank Rathod (2):
PCI/AER: Fix memory leak in aer_recover_queue() on kfifo buffer overflow
PCI/AER: Fix memory leak in aer_recover_work_func() when pci_dev is
missing
drivers/pci/pcie/aer.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
---
base-commit: 248951ddc14de84de3910f9b13f51491a8cd91df
change-id: 20260803-b4-fix-aer-memleaks-524a1bd5e888
Best regards,
--
Priyank Rathod <[email protected]>