Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9045102pxu; Mon, 28 Dec 2020 05:17:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXvhxa7g7h/Y+SP2evvGGw/ADMpXr2069JXig+Ag7vxvnfH5ql7vBQsuoomo5LeWeQCqgV X-Received: by 2002:a05:6402:202e:: with SMTP id ay14mr42988695edb.102.1609161454376; Mon, 28 Dec 2020 05:17:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609161454; cv=none; d=google.com; s=arc-20160816; b=q5IiVzK3RO6H8qzrmUfL0LN+L8rodfvxgMUefyvdBsmt8JM1wtttG3cop7vnwFrzLu JC/bH1Ca6CTd1u7dHzHibVQvEKvVHvKmwhHa+3+uSSDLg9cX3l6djG2xOGB2ZTngXFue JZcHa8QSdV4KH1iAkjxSNSV2nyOoMczs+5ZaGqrXuGr53NSZQDLlyg/kKZc06yA970qU pSJz3KEyoGfN7cUSSOCKHSWobxG/lcQ/dg5LolqJz80bXIEZAAegyr/VPonZbpwm5G1S oZweAHda2ZwgPd7kDXIn8mXYKmFCWgOUs8lZePJxziOnkaC46VHjQbBhbdQXLAW4emQ5 vpWw== 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=O0D4TRSknKDhjKlhAT52TCg26MvFHVaa/4pPcvhdU70=; b=BEpG3hKHHdC/ZIyre1dPbq2UGFxXpYg0XKO//2QLhoxwpMNioxizPn0pnyXH1IwV9/ rIyXHH1YzcdmG7/YUWdEAto34nZqnO8yBLUIpfh5IQFZyCm68m9WntqyZPgjksggejRY xrg3Er7T5ImXxnrn04Jb3oIbFSDYMA3bIXBUgwo42oCZ3gP9tioDn2moAmxbxOLlPeCy EQjnpv8SFoo0WFldIVu933rbb7wXefh7K7TFndqN0rty5NY5q7cqh15qubR0xiz8FaSz xiSaKR1kMheru94fzPlkm/c/lKejZGRgnFxNq6MW3sGGNIw1ZucihSIbeTY5VJq7/rZi /okg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oqEyorQh; 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 gz21si18998493ejb.604.2020.12.28.05.17.11; Mon, 28 Dec 2020 05:17:34 -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=oqEyorQh; 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 S1732656AbgL1NPT (ORCPT + 99 others); Mon, 28 Dec 2020 08:15:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:43460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732641AbgL1NPM (ORCPT ); Mon, 28 Dec 2020 08:15:12 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 73A2B22582; Mon, 28 Dec 2020 13:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161272; bh=1c16DeVlrkOsAw+l3Lm1Es+96/1hWK5NAZRQZL8BiEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oqEyorQhxIQF6Oz8oMIO9gFp2fjDpRCIsS/5yuzXi8tHQ55aI4WH7j4F2ctZ67p6t wIXVsn6o60LZ2u5/QY+iLokORuGKUva2PJHK2zV6yeqy+dWMhpx1BuVszrwVYjmP7F BhqgGwoin+KSn1v/SdS8S5r7JzpdtRdElYkU9P6A= 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.14 159/242] irqchip/alpine-msi: Fix freeing of interrupts on allocation error path Date: Mon, 28 Dec 2020 13:49:24 +0100 Message-Id: <20201228124912.525158358@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 63d980995d17d..ac431697ebe1c 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