From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5EA2C433F5 for ; Wed, 22 Sep 2021 01:17:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BAAB760240 for ; Wed, 22 Sep 2021 01:17:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232328AbhIVBTR (ORCPT ); Tue, 21 Sep 2021 21:19:17 -0400 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:42674 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbhIVBTQ (ORCPT ); Tue, 21 Sep 2021 21:19:16 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=kaige.fu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0UpBB9mw_1632273464; Received: from B-J1X9LVDL-1650.local(mailfrom:kaige.fu@linux.alibaba.com fp:SMTPD_---0UpBB9mw_1632273464) by smtp.aliyun-inc.com(127.0.0.1); Wed, 22 Sep 2021 09:17:45 +0800 Subject: Re: [PATCH] irqchip/gic-v3-its: Fix potential vpe leak To: linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, maz@kernel.org, shannon.zhao@linux.alibaba.com References: From: Kaige Fu Message-ID: Date: Wed, 22 Sep 2021 09:17:44 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping ... ÔÚ 2021/9/15 ÉÏÎç10:20, Kaige Fu дµÀ: > In its_vpe_irq_domain_alloc, when there is error calling its_vpe_init > with vm->vpes[i], it says that the number of vpes which has been > initialized are 'i'. So, the correct value passed to > its_vpe_irq_domain_free should be 'i' instead of 'i - 1' because > its_vpe_irq_domain_free takes nr_irqs as its third parameter. > > If we pass the 'i - 1' to its_vpe_irq_domain_free, the vpe[i - 1] will > be leaked. This patch fixes it. > > Fixes: 7d75bbb4bc1a ("irqchip/gic-v3-its: Add VPE irq domain allocation/teardown") > Signed-off-by: Kaige Fu > --- > 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 7f40dca8cda5..eb0882d15366 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -4501,7 +4501,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(bitmap, base, nr_ids); > its_free_prop_table(vprop_page); >