From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6315635E1DB for ; Fri, 12 Jun 2026 08:37:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781253458; cv=none; b=OdxfsFpbyIQ5Sk7WMe/gTw98/JNABK7VUWfO4l+cB5bNrxo3Jkao/DP8TIbcR+NmvXDVb39OrsRwzzR8AIQwAkgpFBfo21mhe0SJJ+LVn7UebPNZM0zC54ISteac8K1jIDDyzIteuzSaYKhzkb8F310e74WmowBWG56xK525UVA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781253458; c=relaxed/simple; bh=VmHJyDVbeWEL9S3iNtd6IoAg/8hWpDTqvadzIQSZzAA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gjJ/zaRVTIyXj+qhoHUQIBJSDRBaFTGQ0VB15Mwg/Lx+XQHw78ldXim8++msRdKLJj0DQKpLqscktGYC6sFarN+4d7WzSBJvTf0oIBbu82O1x86gUlEXtnHiy5czlrXydm3qF6SJ3hon6JTarMAkGUjDto0FMM0xYGnJyibfvEY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=AjAiNfxM; arc=none smtp.client-ip=117.135.210.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="AjAiNfxM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=IE BSkEYgaylgfIhKaWrWVXkPwy/VflPUEv4kY8gscLs=; b=AjAiNfxMMskFEFI7Av 8xKWC/sp+PUa36y9Eh4Z8wxqG40lKhwJF+Vkc+vdOIGSnYoQQuYdW0/bQK2cjzUH EBX+pvtsHLKLrlMDt0WYKzm37gMm2C4233U5ykSGLFfCQTXaBibCsKRN1Bg6ZxXD YePk4FhiQGJ3hti/PyfAas5Ys= Received: from localhost.localdomain (unknown []) by gzsmtp3 (Coremail) with SMTP id PigvCgCHP_46xStqYPm+Bw--.60670S2; Fri, 12 Jun 2026 16:37:15 +0800 (CST) From: fffsqian@163.com To: maz@kernel.org, geert+renesas@glider.be Cc: tglx@kernel.org, linux-kernel@vger.kernel.org, Qingshuang Fu Subject: [PATCH v2 1/1] irqchip/renesas-irqc: fix generic IRQ chip leak on remove Date: Fri, 12 Jun 2026 16:25:38 +0800 Message-Id: <20260612082537.1212357-1-fffsqian@163.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:PigvCgCHP_46xStqYPm+Bw--.60670S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxJr1fXr1UtF1Dtr4kWFW8Crg_yoW5JryrpF 48u34q9r4UGr1UXr18Cr48ZFyag3y7K3yUta4SgwnIv345Jw1DWFyqqF4jvF109a18Ka1Y vF4kXaykCFyUAFDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jOPEfUUUUU= X-CM-SenderInfo: 5iii21xldqqiywtou0bp/xtbCwRvkr2orxTtRfgAA3B Thanks for your careful review and correction. Changes in v2: - Corrected Fixes commit hash to 99c221df33fbfa1b, the commit that introduced nested generic chip allocation. - Code remains unchanged; calling irq_domain_remove_generic_chips() unconditionally in the error path is safe per your feedback. From: Qingshuang Fu Date: Fri, 12 Jun 2026 14:02:37 +0800 Subject: [PATCH v2 1/1] irqchip/renesas-irqc: fix generic IRQ chip leak on remove The driver allocates domain generic chips using irq_alloc_domain_generic_chips() during probe. However, on driver remove, the generic chips are not automatically freed when the IRQ domain is removed because the domain flags do not include IRQ_DOMAIN_FLAG_DESTROY_GC. This causes both the domain generic chips structure and the associated generic chips to be leaked. Additionally, the generic chips remain on the global gc_list and may later be visited by generic IRQ chip suspend, resume, or shutdown callbacks after the driver has been removed, potentially resulting in a use-after-free and kernel crash. Fix the resource leak by explicitly calling irq_domain_remove_generic_chips() before removing the IRQ domain in both irqc_remove() and the probe error path. Fixes: 99c221df33fbfa1b ("irqchip/renesas-irqc: Move over to nested generic chip") Signed-off-by: Qingshuang Fu Reviewed-by: Geert Uytterhoeven --- drivers/irqchip/irq-renesas-irqc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c index a20a6471b0e4..a340d27dd8d7 100644 --- a/drivers/irqchip/irq-renesas-irqc.c +++ b/drivers/irqchip/irq-renesas-irqc.c @@ -211,6 +211,7 @@ static int irqc_probe(struct platform_device *pdev) return 0; err_remove_domain: + irq_domain_remove_generic_chips(p->irq_domain); irq_domain_remove(p->irq_domain); err_runtime_pm_disable: pm_runtime_put(dev); @@ -222,6 +223,7 @@ static void irqc_remove(struct platform_device *pdev) { struct irqc_priv *p = platform_get_drvdata(pdev); + irq_domain_remove_generic_chips(p->irq_domain); irq_domain_remove(p->irq_domain); pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); base-commit: 2b414a95b8f7307d42173ba9e580d6d3e2bcbfce -- 2.25.1