mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ali Tariq <alitariq45892@gmail.com>
To: daire.mcnamara@microchip.com
Cc: lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org,
	robh@kernel.org, bhelgaas@google.com,
	minda.chen@starfivetech.com, conor.dooley@microchip.com,
	mason.huo@starfivetech.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	alitariq45892@gmail.com
Subject: [PATCH v3 0/2] PCI: plda: Fix IRQ teardown and error-path resource leaks
Date: Thu, 23 Jul 2026 19:04:32 +0500	[thread overview]
Message-ID: <20260723140434.675512-1-alitariq45892@gmail.com> (raw)

This series fixes two related IRQ-handling bugs in the PLDA PCIe
driver, both originally found by automated review from sashiko-bot
during work on an earlier, unrelated patch.

Patch 1 fixes a use-after-free: plda_pcie_irq_domain_deinit() removed
pcie->event_domain while devm-managed event IRQs requested from that
domain still had their free_irq() deferred by devres, so the deferred
cleanup could dereference an already-freed domain. It also hardens
the function so it is safe to call from partially-initialized state
(guards IRQ fields against being 0, and disposes of IRQ mappings
before their domains are torn down).

Patch 2 fixes resource leaks in plda_init_interrupts(): several error
paths returned directly without unwinding IRQ mappings or domains
already created earlier in the function. It adds shared error-handling
labels that call plda_pcie_irq_domain_deinit(), relying on the mapping
disposal added in patch 1.

Patch 2 depends on patch 1 and should not be applied on its own.

Both patches were build-tested and boot-tested on a StarFive
VisionFive v1.2A board.

Changes in v3:
- See individual patches for per-patch changes.

Ali Tariq (2):
  PCI: plda: Fix use-after-free of event IRQs during teardown
  PCI: plda: Fix resource leaks on error paths in plda_init_interrupts()

 drivers/pci/controller/plda/pcie-plda-host.c | 52 ++++++++++++++++----
 1 file changed, 42 insertions(+), 10 deletions(-)

-- 
2.34.1


             reply	other threads:[~2026-07-23 14:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 14:04 Ali Tariq [this message]
2026-07-23 14:04 ` [PATCH v3 1/2] PCI: plda: Fix use-after-free of event IRQs during teardown Ali Tariq
2026-07-29 16:31 ` [PATCH v3 0/2] PCI: plda: Fix IRQ teardown and error-path resource leaks Manivannan Sadhasivam

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=20260723140434.675512-1-alitariq45892@gmail.com \
    --to=alitariq45892@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=conor.dooley@microchip.com \
    --cc=daire.mcnamara@microchip.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=mason.huo@starfivetech.com \
    --cc=minda.chen@starfivetech.com \
    --cc=robh@kernel.org \
    --cc=stable@vger.kernel.org \
    /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®