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 7BB2837C912; Tue, 16 Jun 2026 15:54:43 +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=1781625284; cv=none; b=JrHtrunTYdvRdAXFQp2GQ9Wu/9TdxQd1p9zwycEUxFnZWKT9LJeExWhvmiQpmetRs1YMmxvW+IfvlyKdviEp5YKXcGTabBIre3++LnzDg1kYsH54RTJuN8mOR2hoGoFSf3P61Dl6mBtWH/hsqtAgUkdlxwG4Q8xM8NMaAhxSiEE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781625284; c=relaxed/simple; bh=dbqe5Rh6gyU6/8weQP38aWdHzrZ6oNBJLRBKgLiDQ7Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q2FnKFVtT3PeKvgwDvLZiyF3vHWhNbgUeQgoZELLDCbAUtlm9xTHEQk5vu8JAfiu10lNzuUbzCcMjVAgpB+0OIGPWEGq0vbvJpuwMW8ZHz441miklAWCzFOsfg1lWPkvUHXBwrYCTC7Va2K3UE3aFVCo7NjNFHpfxqputXON0Jc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Iu4jsoif; 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="Iu4jsoif" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89CFD1F000E9; Tue, 16 Jun 2026 15:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781625283; bh=0eLQxnL4hTgVI87xjtLQo6amrFSdfMaFilkfhR+HVj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Iu4jsoifQRNL1fjDIaicTFKv1tr95HoIBOg3eYifIPsMPVwNese9njlPZs5zn+fNt NtfMTl7dsdTNwRnhJK0IECjgnksuKJLGFiHgxrbm5QRFH2yjIshTClV34kjzfVx+uY HugfJAd5B8QSYvSq7YpkkDsb7Elt2lu964hTMD78= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Marco Scardovi , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.18 111/325] gpio: rockchip: fix generic IRQ chip leak on remove Date: Tue, 16 Jun 2026 20:28:27 +0530 Message-ID: <20260616145103.235245528@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145057.827196531@linuxfoundation.org> References: <20260616145057.827196531@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.18-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: 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 1ef0ba956cfd8c..46dd9085d9c8cd 100644 --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -802,8 +802,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