Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3922549pxb; Mon, 4 Oct 2021 12:43:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBUT+8WXnGUnUhQdMXmHR3DryEK8KBCItpw1f9tMzcEN8hXNYh+3gWh5bg/XN01SZ6XKHw X-Received: by 2002:a17:906:5590:: with SMTP id y16mr4472348ejp.286.1633376611435; Mon, 04 Oct 2021 12:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633376611; cv=none; d=google.com; s=arc-20160816; b=cQefOV0pxGwkLj/v3dZeHTv/XPMQq9bl3Pe3z4G/L2sfT9NlbSLgNzqVAa8XMm6eVc XvYRfOrfGwWz8itBI36EXCXzinB4ggi/3MX/+suBvTiqFMONeia+96AnP7ISLhpstBf6 CKgptT9q2RMXVrZ8jtCfn+wHDVvnFVO/y7NE1OBkvgUGSrIUPteYmBK2CyKTfS3x78DY z2KLQhjXiufFUOuihvxC1ECiY53MEO6yvLROx7TYVLJFgDsLY3p4seqXgojrPeZl+q7L spJF5pkaORDzj2HiqHeAeduRqvz6fHQJ6biwQfOeOGC/WfOipH8OqDt316be7YI8w44Y txRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Tvl0EO6+0AMJpnIIXorKJNRQt62DUsV4lNEJmqbtlM=; b=teNQxswuqUaXHXjwr2qlO9LpEE+XFMdQk38DTP0JTIn6uh2GiwUtev7S0oHi6ql1st 4hO5pspO9d1w+1dnTZo6FiBMYsEEprT6cdtfiXTO4By+8tY1aLXBqnSzQGFBqOel+Q1H /PmCYBebQhioFPVLhHSYlgn+QihlnVUlGqvwo8RUlFdGoDaqCywn2svXHDpSb0kqjHwP +jArGjbie2xnqBKBOI0+kmVy6Ic4TmamMb/roA5BqFcSs6uymw4MvLWYESKieJKQQp8C Hlulh+ZyREVWCahhKk0GTkyYG9NgPkc7dyc+BwI4d80fWeB6dn8UG3TY3O8ggEnIeFGi k/VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ieFpEIGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kd13si18710003ejc.406.2021.10.04.12.43.03; Mon, 04 Oct 2021 12:43:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ieFpEIGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233382AbhJDNDy (ORCPT + 99 others); Mon, 4 Oct 2021 09:03:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:60396 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234126AbhJDNCH (ORCPT ); Mon, 4 Oct 2021 09:02:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 03AC2615A4; Mon, 4 Oct 2021 12:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633352335; bh=3+uSUMwiGr0vWOPVOODaHR+2+RrS0BvRSyqfqhN1DcM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ieFpEIGJAEWt1BAhBkxvefFdedg4DVBZKR9RDJ8KnNrpzcXKNk9IyJuzH4L1aaZuU COPKPQoaxEcUC1MKIUnds4vuk6wnhWGTdlc/FGiKjfJ7z70ON57CXE+pRIbWS8bAd1 zSQbB+kPF53QK8sK2Vg38VLR/bngclzFeJV7yev8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kaige Fu , Marc Zyngier , Sasha Levin Subject: [PATCH 4.14 21/75] irqchip/gic-v3-its: Fix potential VPE leak on error Date: Mon, 4 Oct 2021 14:51:56 +0200 Message-Id: <20211004125032.229863489@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125031.530773667@linuxfoundation.org> References: <20211004125031.530773667@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kaige Fu [ Upstream commit 280bef512933b2dda01d681d8cbe499b98fc5bdd ] In its_vpe_irq_domain_alloc, when its_vpe_init() returns an error, there is an off-by-one in the number of VPEs to be freed. Fix it by simply passing the number of VPEs allocated, which is the index of the loop iterating over the VPEs. Fixes: 7d75bbb4bc1a ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown") Signed-off-by: Kaige Fu [maz: fixed commit message] Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/d9e36dee512e63670287ed9eff884a5d8d6d27f2.1631672311.git.kaige.fu@linux.alibaba.com Signed-off-by: Sasha Levin --- drivers/irqchip/irq-gic-v3-its.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 1d2267c6d31a..85b4610e6dc4 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -2730,7 +2730,7 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq if (err) { if (i > 0) - its_vpe_irq_domain_free(domain, virq, i - 1); + its_vpe_irq_domain_free(domain, virq, i); its_lpi_free_chunks(bitmap, base, nr_ids); its_free_prop_table(vprop_page); -- 2.33.0