From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.5]) (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 8F14F39E6FD for ; Fri, 12 Jun 2026 06:55:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781247327; cv=none; b=kLyp/n8Jp+iUb8am6KUcLhb6+ZL55ls2yiYAfrmqiEAr1WyYO5eYg1yi/aW07M12h6fg8i8twuJezqov6xj+6v6ifgMUULAkzWiIlpilfpCMAPN3Mmpzif2piE49gNzPfIfVDV+/CksiKHkBzioYmjuPWv2fhmVlbp8fUNH5XhI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781247327; c=relaxed/simple; bh=MjCwf6JJbDn9XEX0Nhsh+lEcpBdHhzYbPOjrFAKjjio=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Ck8fjgPMGt9AYlt7bqj8n3Q43CLULdtR7yrs5UHutEggVkyiPwMd9pqLdc5HQpLBpm4rOVd+Pz3zgXkuiasEx2Q993WXkN1cMia7239W/MQVvViWIA+g6rAeHf8OXRz6a9MprIyWXWc3A0n4EtsAyoGDg8yRKqrMWKuHDERYhJg= 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=Sc6hEXgI; arc=none smtp.client-ip=117.135.210.5 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="Sc6hEXgI" 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=3H 7tAcb/S9mvf0/jlHG+ljs1djojnPbLvXQm8J7wVfU=; b=Sc6hEXgIPlSQ4lp6ty Pym36Ju81xeK5lMHjAshBr+Vw5wS6G8MJISpZN1kBREzSd8IYIhlZxcYRT7/+a1C GFDQsJ5zHk8zJdAosgee0SA3D34HEiiiZ7wiWtwcUavfCZa3T/YGnA/oIG9u6rF1 m+PbNCyrp9xEhzuY1m7ClnCbU= Received: from localhost.localdomain (unknown []) by gzsmtp2 (Coremail) with SMTP id PSgvCgB3h_VHrStqr+eTBg--.31744S2; Fri, 12 Jun 2026 14:55:04 +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 1/1] irqchip/renesas-irqc: fix generic IRQ chip leak on remove Date: Fri, 12 Jun 2026 14:55:01 +0800 Message-Id: <20260612065501.1168892-1-fffsqian@163.com> X-Mailer: git-send-email 2.25.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 X-CM-TRANSID:PSgvCgB3h_VHrStqr+eTBg--.31744S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7uw4xJFWDKry3tFWDZw17GFg_yoW8Zr1fpF 48u3s09r4UGF1UXF10kr1kZFyag347t3y7ta4Sg3ZIv345Jw1kWFyqqFWjvFy0kay8Ga1Y vFs7WayruFyUAFDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07joUDJUUUUU= X-CM-SenderInfo: 5iii21xldqqiywtou0bp/xtbC6gjirWorrUgKJgAA3l From: Qingshuang Fu 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: 17c888920949 ("irqchip/renesas-irqc: Use proper irq_chip name and parent") Signed-off-by: Qingshuang Fu --- 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