From: Priyank Rathod <rathodpriyank@google.com>
To: Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
"Oliver O'Halloran" <oohall@gmail.com>,
Bjorn Helgaas <bhelgaas@google.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org,
Priyank Rathod <rathodpriyank@google.com>
Subject: [PATCH v2 0/2] PCI/AER: Fix ghes_estatus_pool memory leaks in error handling
Date: Mon, 03 Aug 2026 21:59:37 +0000 [thread overview]
Message-ID: <20260803-b4-fix-aer-memleaks-v2-0-fd199b0171fd@google.com> (raw)
When firmware reports PCIe Advanced Error Reporting (AER) events via ACPI
APEI GHES (ghes_handle_aer()), it allocates a snapshot buffer from
ghes_estatus_pool to store the aer_capability_regs registers before
enqueuing the error record into aer_recover_ring.
If the error record cannot be enqueued or if the dequeued record cannot be
processed, the pool memory allocated for aer_capability_regs must be released.
Otherwise, unhandled errors silently leak memory in ghes_estatus_pool,
eventually leading to pool exhaustion and breaking system-wide GHES hardware
error reporting.
This series fixes two memory leaks in PCIe AER error handling:
Patch 1: Fixes a memory leak in aer_recover_queue() when kfifo_in_spinlocked()
fails due to a buffer overflow (aer_recover_ring capacity of 16 full).
The rejected entry is immediately freed via ghes_estatus_pool_region_free().
Patch 2: Fixes a memory leak in aer_recover_work_func() when a dequeued entry
cannot be mapped to an active PCI device (pdev is NULL). Refactors the
loop so ghes_estatus_pool_region_free() is called unconditionally for
every dequeued item.
Changes in v2:
- Refactored aer_recover_work_func() to ensure ghes_estatus_pool_region_free()
is called unconditionally for every dequeued item.
- Added Patch 1 to fix related memory leak in aer_recover_queue() on kfifo
buffer overflow.
- Updated commit messages with detailed pool allocation and lifecycle 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 v2:
- Refactored aer_recover_work_func() to ensure ghes_estatus_pool_region_free()
is called unconditionally for every dequeued record.
- Added Patch 1 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>
next reply other threads:[~2026-08-03 21:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 21:59 Priyank Rathod [this message]
2026-08-03 21:59 ` [PATCH v2 1/2] PCI/AER: Fix memory leak in aer_recover_queue() on kfifo buffer overflow Priyank Rathod
2026-08-03 21:59 ` [PATCH v2 2/2] PCI/AER: Fix memory leak in aer_recover_work_func() when pci_dev is missing Priyank Rathod
2026-09-04 2:59 ` [PATCH v2 0/2] PCI/AER: Fix ghes_estatus_pool memory leaks in error handling Priyank Rathod
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260803-b4-fix-aer-memleaks-v2-0-fd199b0171fd@google.com \
--to=rathodpriyank@google.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mahesh@linux.ibm.com \
--cc=oohall@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®