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 D0029340D9D; Sat, 12 Sep 2026 10:10:14 +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=1789207815; cv=none; b=K0DQunRdkBdg7XL4uvpgLmITJn5YQ9qgYM87rDkPJcKqwJjyhZtDfG9iUq4y6uGNcjWoBICAc3RS6+M1ZDFd0kiscWw5mwsX2mwuPmXi57JWs7BY8hLN22MUpuzlNsCcYCJoIJLJW0GNR0RH5UJ9ZCceHY+n47wRdJ/S1lUJCuM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789207815; c=relaxed/simple; bh=h0dF2BqCOr0r2J2wSa2LIFRAb3ARlqnGH7PUKS8Y7QE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NN6r7iqbE2DtyjhX8wIyCMRSD62HtyXlsZJjBCg47bHir/lCoPNlQHjhsQDs9jVPLt2OB1wYW32yaRKB/Aug2sFeah5ahDkZWK8LyMwHF9u1Cm4PBFajh1IeHIYRuKKvE4wqMAFWdTMWrJFaXOrB8JnqCIssEaDsSOOC1mOaJ0E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uPHlEdnM; 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="uPHlEdnM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 885991F000FF; Sat, 12 Sep 2026 10:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789207814; bh=n2KzKaHR86txq6pPRZfSYiPSONI87RanDashsNyIW/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uPHlEdnM9MtzPNDMjVfcIutx99Xf23prAJPyVJzBjYqDiuX55n5iBcoLnmiAY54qk k2Ieom2VYS+SS3fC5uNYmAydD7jiE4+OpEGyJUlrSrP5CudDd2doBT4/950sTvdDuf Yx2yz06WEqCsWC2RbTWE8Z2jrc/QpfCKywdeAzeQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kemeng Shi , Thomas Gleixner , Marc Zyngier , Sasha Levin Subject: [PATCH 6.18 0489/1518] irqchip/gic-v3-its: Prevent leak in its_vpe_irq_domain_alloc() Date: Sat, 12 Sep 2026 08:44:18 +0200 Message-ID: <20260912065634.509614997@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065623.398859879@linuxfoundation.org> References: <20260912065623.398859879@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: Kemeng Shi [ Upstream commit 325ff3e78c64cd619d52b99f7c8b09a3f31e1495 ] When its_irq_gic_domain_alloc() fails, the following its_vpe_irq_domain_free() fails to invoke its_vep_teardown() for the corresponding interrupt, which leaks the resource. Invoke its_vpe_teardown() in the error handling path to avoid the leak. [ tglx: Massaged change log ] Fixes: 7d75bbb4bc1ad ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown") Signed-off-by: Kemeng Shi Signed-off-by: Thomas Gleixner Acked-by: Marc Zyngier Link: https://patch.msgid.link/20260721063241.52549-2-shikemeng@huaweicloud.com Signed-off-by: Sasha Levin --- drivers/irqchip/irq-gic-v3-its.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 627b708c96264..93ad36c7a73e8 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -4593,6 +4593,13 @@ static int its_vpe_init(struct its_vpe *vpe) static void its_vpe_teardown(struct its_vpe *vpe) { + /* + * If vpt_page is NULL, then its_vpe_init() has failed, and + * there is nothing to do as no resource has been allocated. + */ + if (vpe->vpt_page == NULL) + return; + its_vpe_db_proxy_unmap(vpe); its_vpe_id_free(vpe->vpe_id); its_free_pending_table(vpe->vpt_page); @@ -4673,8 +4680,10 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq irqd_set_resend_when_in_progress(irq_get_irq_data(virq + i)); } - if (err) + if (err) { + its_vpe_teardown(vm->vpes[i]); its_vpe_irq_domain_free(domain, virq, i); + } return err; } -- 2.53.0