From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj2-f4.google.com (mail-pj2-f4.google.com [74.125.227.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2746363090 for ; Thu, 23 Jul 2026 14:05:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.132 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784815505; cv=none; b=ijyrJstC0aIxdgjZDA3kB3w2LXv0S8IWbshU1ueBKwFwbvLY1/7+MiDKxEDquap+TsGZiUDYhvyqAQ/3EKCAjYWg0Dls4/s4knBk8ZICj08fPS4KYQuitnmDOfMvWyEhsIi2S1lix/ZnYU0AT10cjF4R+fhag5YZB/efAgQJaXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784815505; c=relaxed/simple; bh=lIVSpYNXYggwgLGuyXWDQmUidMbwlvbUwtc0BioajXM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=n7jHhAs/bFvYPhAv32lPTNIGETPSQFN5xQ8lf5d13PfbDzXUNxroWGmHwHe1Ms0A55wCctE2HeJLAaR53XptSSGa4y7hupH3Fvfnb830fYgpbJoFHzGVZYRCfKBIl52F9niaRUiWNYWbA+fCvOhdyaqmA3BF72zjOEuZUh7+JKo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nokfAtYr; arc=none smtp.client-ip=74.125.227.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nokfAtYr" Received: by mail-pj2-f4.google.com with SMTP id 98e67ed59e1d1-38111ea8a88so458035a91.1 for ; Thu, 23 Jul 2026 07:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784815503; x=1785420303; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=fEvTy714BzLXGkO9IMhH+5Gou32h276dSsrXDfWR0to=; b=nokfAtYr4DwzKbzWuwdmVnHUP5pUz8JzXi8u4LlAMo2Cml48lhNNk9go1cHPN5fyBH yF90lbj5GFS7O1UPMAKjtWfFmVGPlxIiXA+QBz3ErYv2umCCagKrrgP5Ed8MVZ08Lztp GyYQhV4V0U/p63qZxPoww7cF93bHwLLZrD5hRocdPl3AKJ1r8hdC+Hy1rjNd/HNPJyII hNjKALAt4Fibrdt3HSRJFzx+/WqhTUmjLIC84u8V0FRyNtPCeI5w40x3+wuMpwDNnnp9 ipMFJr3T3RJtridtUfy5v+CXmGEtRMVBok+hRTTTTOS4+qaXlakihnEsz4ktt/7FOG7o GXcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784815503; x=1785420303; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fEvTy714BzLXGkO9IMhH+5Gou32h276dSsrXDfWR0to=; b=J7UCbJHnP7uR2NGO9ux4UdQyu0xLb7r9JSTyDl17v/xpjh6acAQMT7aif4qg2olWXV kAjOHsVh5qwIh76OTAJCusjRTYZX8jMu58K3HkottrVDV3ZYq/Zet5lVjdvnm5cndTIy A4/ic8x9fQpIfcg6OLZrklKkjkPX48IGlpDCEgkQSuw1L6iGIMHYCTnYOeXftSoKPf2v sIZwH7KmakL/Wjd1p3RDULs8hWNICfq7kLx2av7PxkwDM+eWVu5BNRCqYg9svNdQMr1y pFEriJavveo1wJPsY0O8+FA6QZ6FfpNWeX+qPi3AHQlJmHS5ZVE3+tFChgySU+dNyBWT MLpA== X-Forwarded-Encrypted: i=1; AHgh+RrMhb9oTkWH26BqqUgh98AYh/Ce1xItacWLmbGESu7RJ/IhdfQ0D8yAhZtKG52RKiMAZ+han57BKCWrF8A=@vger.kernel.org X-Gm-Message-State: AOJu0Yxl+XGwWDuMEvhgZxqqtkFtcfZED1cGMeR8poxdaOyo9Bcs4AP/ cWVN5pUa8D3uKv3yNGG3QBAADs4iSvm3HI44lsplUiMktt+HZJHrz4uC X-Gm-Gg: AR+sD11D/MMc32rvTnzH9yYDmTreKYKwyK1nHP3ewISo0glVkdA8uWznwIIJ3H1QDET N8f9jVuYkYYs4SwtR4bnln2HXH2qCVkkcXHQK9hvF/4DnNNVZUhPoqoRAYInDStRY0M5Gmj0Sgw E5oTy06qBZZGU/hPKEUiS89hpbhoXmFCsgKOpxrdWTXZuAEqgchNJxR3UUo5t/uoltZYIvcvpMf 6/unSB7cjDJGjTIt38sozTCupnGqyr6RovPY0c629qKIuyWdiPOkrnwKBzSwz0QRN/oenJW68y8 lx9ojwPnOiTwryYAVeJ/woKWoAuRNhw08fk4MJhI+j/7cTVJ75pfrHzx94ggSGEBYlpb2gzNA3M nawtpInVl+/ERtFzpgSER6B80lzYBUmJYSqs0jkGkY9wGHG1VsqQmEOaTLSZsWaC8sYyXZiMOI0 LKqyZk7rhE X-Received: by 2002:a17:90b:3d43:b0:38e:1497:af5b with SMTP id 98e67ed59e1d1-38ec648a194mr3330767a91.1.1784815502657; Thu, 23 Jul 2026 07:05:02 -0700 (PDT) Received: from workstation.. ([182.180.105.19]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13d130f42bbsm17870433c88.14.2026.07.23.07.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 07:05:02 -0700 (PDT) From: Ali Tariq 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 Message-Id: <20260723140434.675512-1-alitariq45892@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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