Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH v3 0/2] (no cover subject)
@ 2026-08-03 21:51 Priyank Rathod
  2026-08-03 21:51 ` [PATCH v3 1/2] PCI/AER: Fix memory leak in aer_recover_queue() on kfifo buffer overflow Priyank Rathod
  2026-08-03 21:51 ` [PATCH v3 2/2] PCI/AER: Fix memory leak in aer_recover_work_func() when pci_dev is missing Priyank Rathod
  0 siblings, 2 replies; 5+ messages in thread
From: Priyank Rathod @ 2026-08-03 21:51 UTC (permalink / raw)
  To: Mahesh J Salgaonkar, Oliver O'Halloran, Bjorn Helgaas
  Cc: linuxppc-dev, linux-pci, linux-kernel, Priyank Rathod

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/20260803-b4-fix-aer-memleaks-v2-0-d2be03d9864b@google.com

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 <rathodpriyank@google.com>
---
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/20260803-b4-fix-aer-memleaks-v2-0-d2be03d9864b@google.com

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/20260803183853.432459-2-rathodpriyank@google.com

---
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 <rathodpriyank@google.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-03 22:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 21:51 [PATCH v3 0/2] (no cover subject) Priyank Rathod
2026-08-03 21:51 ` [PATCH v3 1/2] PCI/AER: Fix memory leak in aer_recover_queue() on kfifo buffer overflow Priyank Rathod
2026-08-03 22:04   ` sashiko-bot
2026-08-03 21:51 ` [PATCH v3 2/2] PCI/AER: Fix memory leak in aer_recover_work_func() when pci_dev is missing Priyank Rathod
2026-08-03 22:01   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox