Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9249527pxu; Mon, 28 Dec 2020 10:24:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEZfUXJ/j3jwwKHjajTOoyNMoyglFS9YG5T1LMclxcFJFkr40pPz9YJR+GJclFc2bhMVuj X-Received: by 2002:a17:906:d152:: with SMTP id br18mr39146481ejb.297.1609179897993; Mon, 28 Dec 2020 10:24:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609179897; cv=none; d=google.com; s=arc-20160816; b=LLWIcBBqJkmHQFwwEqwZzrJcXPaHnpn1m6VMGHBHX7GEQJNHrQYBQVysfM7zwFhstY oqJFzOyFQvN1gJhVMWG2sUP3tbQ4qbVVQf1kkt009XwZgz7TiNRmeLvrmN20CwTpjrl9 BUId3vaTNQaKnXhgF/25Zcn/Q9/aWd8ad3JhPh7FzDUvfZ5pqJOPrXpOi3PQvfJayp+4 uyQxtwK/EAjorCO57FbhDhEd5AJcsDoTkG9NMmZrjuyFKM5feEgjJYprU2sy4PC7AwxW BgW7LRnTYCLozJBWkpHa5PLsFBodVLtlkdJegW9JyuQIfkA5QudNfW8Ndm1lr1ve8y/7 aNoQ== 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=hPIXeARKAMFSHoW4pk6OuhpvwkpkWJK6j1OapI8ZpZk=; b=kOvtd2yAAAa4Br6as09jEGsg/eEBbcd8UI2u7+8XX/eaU8pGem6ErG2JJane/oIFLh iiGTk1n4xvOJpwEYn80kaA0w7+uwr+HWivdNVDEVCvbCSHnPvvNbpaB9+7jg1CK++cD3 6RZi3vUWpCVrUUdUNNAziy82kymBPgpKwt0yk8ZZ6vtpZcZ6C+1OG5t/1nW0rJutY7hs mMRatD43nxIUYzEfkhEG7mtmlkeiesA8UYD6PCg7PSzPLsrp1E9c/EQQ3dNmyyxEpHXi BlVgZ/JJZMw+oi02lm+dKOfR/pKaLrLtI2fCTgTUOSr4WM/1TMZLauOOrzzJWaUAAbdm /EPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nGM5AH9F; 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 r26si20502487edy.318.2020.12.28.10.24.35; Mon, 28 Dec 2020 10:24:57 -0800 (PST) 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=nGM5AH9F; 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 S2390480AbgL1Nb4 (ORCPT + 99 others); Mon, 28 Dec 2020 08:31:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:59892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390476AbgL1Naz (ORCPT ); Mon, 28 Dec 2020 08:30:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BFC9D22582; Mon, 28 Dec 2020 13:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609162215; bh=FMkKkDgfoQxTyWnUE2Qst9nVebKm1Hc8yMuI6M2USe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nGM5AH9FU/Mf+jyt+66+qcEx5YtksbMxd0th5uvHY4UTGLaYu/ygss2b8kcHGQb6F 9U+bMZz/tMYceQCnb4MAQWndhPNlESdi/GVbort3R8AsRerVoTKx8/gLnUEdpzakX/ XzBpjyrtk5eq6O7Zt5sJxUKnqjSjiLmDhwmGeLow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Antoine Tenart , Tsahee Zidenberg , Sasha Levin Subject: [PATCH 4.19 227/346] irqchip/alpine-msi: Fix freeing of interrupts on allocation error path Date: Mon, 28 Dec 2020 13:49:06 +0100 Message-Id: <20201228124930.747944053@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124919.745526410@linuxfoundation.org> References: <20201228124919.745526410@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: Marc Zyngier [ Upstream commit 3841245e8498a789c65dedd7ffa8fb2fee2c0684 ] The alpine-msi driver has an interesting allocation error handling, where it frees the same interrupts repeatedly. Hilarity follows. This code is probably never executed, but let's fix it nonetheless. Fixes: e6b78f2c3e14 ("irqchip: Add the Alpine MSIX interrupt controller") Signed-off-by: Marc Zyngier Reviewed-by: Antoine Tenart Cc: Tsahee Zidenberg Cc: Antoine Tenart Link: https://lore.kernel.org/r/20201129135525.396671-1-maz@kernel.org Signed-off-by: Sasha Levin --- drivers/irqchip/irq-alpine-msi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-alpine-msi.c index 23a3b877f7f1d..ede02dc2bcd0b 100644 --- a/drivers/irqchip/irq-alpine-msi.c +++ b/drivers/irqchip/irq-alpine-msi.c @@ -165,8 +165,7 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, return 0; err_sgi: - while (--i >= 0) - irq_domain_free_irqs_parent(domain, virq, i); + irq_domain_free_irqs_parent(domain, virq, i - 1); alpine_msix_free_sgi(priv, sgi, nr_irqs); return err; } -- 2.27.0