From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 630A227732; Thu, 16 Jul 2026 14:21:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784211717; cv=none; b=HN5kkGaIZ0DrigqggK/4gmsO+h2oC/KX5GQ0nf9zibwSsdZYFl2qRj9mzrHtouhmN05b/5XocaVBwKynjitDmWaKkKHxT+z/QgOxJ7ydgwJqEAt+8anPSVAYTcN2EpbI9CNK/yvV4JrFIl0LoVLQYjkWe3n7bxxJfY370CC7FHE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784211717; c=relaxed/simple; bh=xYPTZB/KR1TUWi1aJZNw4bxGEpAsPjyh///4h+diwVA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tpalc2YmWHd7x7JXuhAge/dFtrcjNNkc+IfacWvxW5ejsX/UJLOzn0GyceTVc4MA47Gd0Oh7Ue4SiEgz/lB9mtMRoA1qyZLa9qJLGO8QamL5Vj0NuadZd7pmLqVe0EsVc5mgO+DPJEdAk5oXXO3ZUQDVvJZW6E3v4BbtPbIq3yM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=G3o1RBR6; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="G3o1RBR6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C839B1F000E9; Thu, 16 Jul 2026 14:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784211716; bh=Mmop2keVJxwmrqHgmsIWAj68xcffjTw/3B4zFg5S9JQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=G3o1RBR6aw/TtxfZrRfU2IqZCXooAlVBPoFGo4KTKYH9e9nDN1uklfRs1M6Lc8CxL byGQLbbG5U2EUgBpbtcZo5WLBal6ZUeTM9FjOLTNO+rbidWWApvKxQVIisNF2/70Ht Z7vO8HhnCYUjIEdoQpKHjyG1hnHVY2O0S2NR4D+U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Marco Scardovi , Bartosz Golaszewski , Heiko Stuebner , Sasha Levin Subject: [PATCH 6.12 010/349] gpio: rockchip: fix generic IRQ chip leak on remove Date: Thu, 16 Jul 2026 15:29:04 +0200 Message-ID: <20260716133033.522453231@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133033.287196923@linuxfoundation.org> References: <20260716133033.287196923@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marco Scardovi [ Upstream commit 1c1e0fc88d6ef65bf15d517853251f75ab9d18c3 ] The driver allocates domain generic chips using irq_alloc_domain_generic_chips() during probe. However, on driver remove/teardown, 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 GPIO bank 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 rockchip_gpio_remove(). Fixes: 936ee2675eee ("gpio/rockchip: add driver for rockchip gpio") Assisted-by: Antigravity:gemini-3.5-flash Signed-off-by: Marco Scardovi Link: https://patch.msgid.link/20260607230504.35392-2-scardracs@disroot.org Signed-off-by: Bartosz Golaszewski Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin --- drivers/gpio/gpio-rockchip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c index 0a93c74933f08b..9c419625c75332 100644 --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -792,8 +792,10 @@ static void rockchip_gpio_remove(struct platform_device *pdev) struct rockchip_pin_bank *bank = platform_get_drvdata(pdev); irq_set_chained_handler_and_data(bank->irq, NULL, NULL); - if (bank->domain) + if (bank->domain) { + irq_domain_remove_generic_chips(bank->domain); irq_domain_remove(bank->domain); + } gpiochip_remove(&bank->gpio_chip); } -- 2.53.0