Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2817956pxu; Sun, 29 Nov 2020 06:00:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoEHrqvBgU0p9hBdQwGHz2SRPYIhRl/mEFPMG6BTq0j/d8KXEyP1FRcW3rQHykIFQQZTCB X-Received: by 2002:a17:906:1e84:: with SMTP id e4mr16060967ejj.57.1606658457179; Sun, 29 Nov 2020 06:00:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606658457; cv=none; d=google.com; s=arc-20160816; b=zVBXHgQBcZ/RDdatN3xoTrS8MxgVU7K/lBtoJ8hcrBHfEhQYhpz9XMM6im2JkWEEt2 +XKSVIokhBXrNLcIMgo36BI/50i5TrwJ6w5FO7kkw++dFiw+4qXfy21i28DdYY7Afl2N XsZZ9TTRAWag/qHN1w+0ybT+iaflJjQNmFyqOEUgcpwrsQSU6DC9Tlli6JVHcxtwLtk2 UdRnlI538sm2HnK2eD4xKMxHzxECPipyAu9eIB8uPsTTAkJog9y8a+WhoR+wlPLjAhJs IW62gwD3rv0yEVylkXA5vOFBu6HQ7Xw1El0cjaE1ZPFQpP4rl8OH3Xpz8gP8Xkq+ixoh /XBQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=oGM24KaUjs62mdupSwMoNEdP4jJQEU42jPnIlxF6tew=; b=aC4X6vVxDoo9lWOazVOYglqXMsIec3AwH2HaJ1DyUqf8UX0cq1HsbRegLleE/qsb0Y 6STf8UdIHWVVteFScilopR5kREyoqVBhN0MrWVckF7pnOxOpZmSGG8ylSwRkzM3mSnmH MJxYzg1R1O/02QGQEzt8BzFdy81s1SkSYbUUA+pgnc+DKpmx7RFGDcMfImyWudUmd39b mISckIs4WD3IAen8dVvHkQPijRLeVDzjjN0cVbtYg3gNcqcljCFjrBC3yfX85S/B098j S0VSQcBabJYqOjX1V8AadG1un1PLTc/FYUe1DvFsZHurN0z/3A42dhaU3Rx9hsWugzcX zCww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EDWMFoMw; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si4049039edq.494.2020.11.29.06.00.34; Sun, 29 Nov 2020 06:00: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=@kernel.org header.s=default header.b=EDWMFoMw; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727927AbgK2N4O (ORCPT + 99 others); Sun, 29 Nov 2020 08:56:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:35378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725882AbgK2N4N (ORCPT ); Sun, 29 Nov 2020 08:56:13 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 35556207FF; Sun, 29 Nov 2020 13:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606658133; bh=w5h/VEFQpOy6KDELpUVgEpEobX/k+dTfm0ZlTE8e/S4=; h=From:To:Cc:Subject:Date:From; b=EDWMFoMwCPctg3jV42r/fqlwDiL5BHEsZSKDqO+7A+Ni0mw+1ncv53GUWgVIZEG2z Y4RzgZNg/4pmCtsFtr7XVQlFdDeiFYJe1jcWUN/Qox8hvZ3mbZIw97r05Ao+aOMPej fFfvWWasohIcTPS9iZEqrBr+V+TsI7j9dOxxMeNI= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=wait-a-minute.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kjNAp-00ETbu-2E; Sun, 29 Nov 2020 13:55:31 +0000 From: Marc Zyngier To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Tsahee Zidenberg , Antoine Tenart Subject: [PATCH] irqchip/alpine-msi: Fix freeing of interrupts on allocation error path Date: Sun, 29 Nov 2020 13:55:25 +0000 Message-Id: <20201129135525.396671-1-maz@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, tglx@linutronix.de, tsahee@annapurnalabs.com, atenart@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") Cc: Tsahee Zidenberg Cc: Antoine Tenart Signed-off-by: Marc Zyngier --- 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 23a3b877f7f1..ede02dc2bcd0 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.29.2