Received: by 2002:ab2:6991:0:b0:1f2:fff1:ace7 with SMTP id v17csp107642lqo; Wed, 27 Mar 2024 08:09:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWhuMuYcpl4oIa0n7k5MXKIJr48t4WbcVH+xX7jrwDcerWC34hzSF/S7DdTz6XG0UPRcLEUHZl82vQgs9meZYzYgHSjk+Wq9kXXoma3GQ== X-Google-Smtp-Source: AGHT+IF+cDi1FxWLvsOqGVKDXN+onrjVpvnNDaA1wEK3uEwsd9mA1R0CBsZKlVcDBcqWh63aWu7l X-Received: by 2002:a17:903:22d0:b0:1e0:9eeb:cbf6 with SMTP id y16-20020a17090322d000b001e09eebcbf6mr1333866plg.4.1711552164410; Wed, 27 Mar 2024 08:09:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711552164; cv=pass; d=google.com; s=arc-20160816; b=EThHqZqu1CPG1gu5Mo8np1aOzi8Six3eK7mntxjuVRci7l/IG1YdOcFTu4A78EXvk9 OZNPXYDRXTeahQRiXg9k7ipT2fguEzat6kpJo0IrqJ6s4TVM09K5gLLiDn2ZyHY7ASq5 HOvHJ/QRi2zpFU08OLFUMA2QKPx/87rLMLAMOj9YyESQ+g5YnfoMRCCPZ/1flVTN4nuA NDbFkZE9KP+NH6UpFTLqRtVotPWyFFFWArVhkpzWXeBXYMu31i152MKrnjw5VnebJ7Wz +F74xubUII53anCL70Yw0DzIfz6B3Db/yMg75bbX2WEeLzBF0VFiS4UBoxRM45CQRyPW JbEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=m56UOW9K59PH+Mku9ZNt+EW0mDt7gaDrl6jYZFhlXAs=; fh=zB2uOv/yNtiiYuumhxVy6NpxnOqlcMWxICGsxbJBrRE=; b=q6wMWCwwD7bL5GI8PIkSANA5pMSMtBTkTFk1Ih40lYIt1GhtSZX+qzONJn5+PlZODO yVKjyYr7BZP6EuAkYTYST9g5zMhq40zfUFiNIEJNXusZreKLduliERvPU3cbagJwyicE TCl0P4aONDSpXHz3h021ODeoedwWKV5tN2beH1j2B25PnOjoEqE2+N/wRirWQB6Gul2X Oc1dvpUxCwqhzrWHkSOmJiEYjYEbMVEfbsxtTGNjwkF39UyI5j/d5WYotuHhE/YF7rJr WNDlXjAJL5psB5ToAp4PCTN+ANZoGITPQwcQLTGAVXU3511OOULPgbQpAPG/2A4+sJRh Anww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-121419-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121419-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j16-20020a170903029000b001e08930a8f7si9960186plr.575.2024.03.27.08.09.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 08:09:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121419-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-121419-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121419-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 22F392E6EAD for ; Wed, 27 Mar 2024 15:02:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AE39145327; Wed, 27 Mar 2024 14:23:18 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 F35EC144D08 for ; Wed, 27 Mar 2024 14:23:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711549397; cv=none; b=PvE+rkZ1iDKRvf49zasg8zXpC+3sxk2iWol5YUAc4id2xkGjkjKMD0D68phHDYy8bE77zvOUwKQjlOroxqiWIJkgeO2rEaZDOMw7ks1vVblZpunDZFXzcoKbEJYLIWOcWcMSAn3eIh3SA6qlxoSfDC45vIK/Hksh0GxMoGEB2xg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711549397; c=relaxed/simple; bh=zRI5GV7a1ReZEinUIATHZ6Ua1rtRrj/S/oB2DPjv1eE=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=jdY5bV7vjNwHv/S2A9xc/7dYSd4XEuJh3yU0kO4drbpOI5FuKz8dEVqu+1kaS7dOR58R4WIQdlxPWsHOWDZnhnfURLYsmn61i3UkVoUWL/8m8sV4Z66UbhK0YqxQgfi81ehR9xV7ozZZBzyu0wwzUi+206yoMCSf7dOdIiu5zrE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4V4TN94sBJzXjx6; Wed, 27 Mar 2024 22:20:25 +0800 (CST) Received: from kwepemm600007.china.huawei.com (unknown [7.193.23.208]) by mail.maildlp.com (Postfix) with ESMTPS id 047BF140258; Wed, 27 Mar 2024 22:23:13 +0800 (CST) Received: from DESKTOP-8RFUVS3.china.huawei.com (10.174.185.179) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 27 Mar 2024 22:23:12 +0800 From: Zenghui Yu To: , CC: , , , Zenghui Yu , Tsahee Zidenberg , Antoine Tenart Subject: [PATCH] irqchip/alpine-msi: Fix off-by-one on allocation error path Date: Wed, 27 Mar 2024 22:23:05 +0800 Message-ID: <20240327142305.1048-1-yuzenghui@huawei.com> X-Mailer: git-send-email 2.23.0.windows.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600007.china.huawei.com (7.193.23.208) When alpine_msix_gic_domain_alloc() returns an error, there is an off-by-one in the number of IRQs to be freed. Fix it by passing the number of successfully allocated IRQs, instead of the relative index of the last allocated one. Fixes: 3841245e8498 ("irqchip/alpine-msi: Fix freeing of interrupts on allocation error path") Cc: Tsahee Zidenberg Cc: Antoine Tenart Signed-off-by: Zenghui Yu --- drivers/irqchip/irq-alpine-msi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-alpine-msi.c index 9c8b1349ee17..a1430ab60a8a 100644 --- a/drivers/irqchip/irq-alpine-msi.c +++ b/drivers/irqchip/irq-alpine-msi.c @@ -165,7 +165,7 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, return 0; err_sgi: - irq_domain_free_irqs_parent(domain, virq, i - 1); + irq_domain_free_irqs_parent(domain, virq, i); alpine_msix_free_sgi(priv, sgi, nr_irqs); return err; } -- 2.33.0