Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3522658pxf; Mon, 15 Mar 2021 11:26:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzU4oMRIqSx/sQNwnVQVVIK8AR4VpbRzn1rvgQ4tjR6el6mNNQDuJ26pVGdzp29KtRBBT0R X-Received: by 2002:a05:6402:13ce:: with SMTP id a14mr31595116edx.365.1615832785295; Mon, 15 Mar 2021 11:26:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832785; cv=none; d=google.com; s=arc-20160816; b=IusuUcT5Ggaxz6xT5ywET/bDun46SaD4XCstoFRisZ8DfS/sKWFBECPiVF3JM+PHhg CAC7Jwk3wUl+c8q/Er0zKcZJ2sdUl7z5/XAJi7sBmWnpEm27cItWG6Y1i4FsSWhnSb4X K9IiE6o35fSEYjt75oU5Cr4HPmDDHSOk53cXM5AZKJNsPI8XkgeegtVbo6Pr/yNXjfbS 6YR4bW0srvYJZKCuWrIHs0UdpQpUmeE++3ytSJr4VacxjkgZktILMFBGc0rX/G5UMR3y y/II92q/WWYcfIlypKqET5FEKd1SC0kIDsJflfWawiH8E/hw9pkqXK/emUWUEr03i2Nc pNzg== 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=589xCCbu0IkfihKoGyr3qXg1zf96G6OJlZnoo3jWjbU=; b=tfzOkQCu6t8a8bPWQr0CNf93HsTArQxMcYJuWd783RWePBcM8c7xU1OnF+RyFK/4t2 9jPj7V9MuD75uM2NlSvmI4AGPajQed1+JgrBSuxwR22v+o7rbtupvNMFpcL233Byj0GP p35GEaIw/5kT59YjB3SQVwKOy3hCgpKGvEJ0DfM9g/lLCA1VDgKxzf81hffwftBzG5yA MJkXIMVSVJPzVohsu6Jhg+UhORAS7bzmcBJ6yjzK0eHDwcs6ZPlDMgxKtMhyc0WE86FN IOZ9r6URcGmfq0BRPydGOwRVXRH0tfvZvXmgVW8PtVgKS4yyWu4u+5KjXYKGDSMnfWFE jh+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QPMbx5KD; 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 c14si12637177edn.523.2021.03.15.11.26.02; Mon, 15 Mar 2021 11:26:25 -0700 (PDT) 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=QPMbx5KD; 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 S239097AbhCOO1p (ORCPT + 99 others); Mon, 15 Mar 2021 10:27:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:35610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233097AbhCOOAi (ORCPT ); Mon, 15 Mar 2021 10:00:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0CFC964F6D; Mon, 15 Mar 2021 14:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816825; bh=d+4xpJa7BJFumZ5sJgfSVbsuYD7yrrx4k1xWh1nF4t4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPMbx5KDLfVhQAto0dO8LN9IT1BZRYSYoiWeDGm3Vv5zYJ9Xe8fWuDzS6mCpI8AVL UgqUwaZUsAuDIV10EgUSyZt7XB4Hc+lde7qftS//X8Jstl5hiUToGWdI6Xp1v6oSGZ a6gB8yKPvj20JQGCaHVZE2aH5CqVXAM803+i6wXs= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Kaiser , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.11 147/306] PCI: xgene-msi: Fix race in installing chained irq handler Date: Mon, 15 Mar 2021 14:53:30 +0100 Message-Id: <20210315135512.616879635@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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: Greg Kroah-Hartman From: Martin Kaiser [ Upstream commit a93c00e5f975f23592895b7e83f35de2d36b7633 ] Fix a race where a pending interrupt could be received and the handler called before the handler's data has been setup, by converting to irq_set_chained_handler_and_data(). See also 2cf5a03cb29d ("PCI/keystone: Fix race in installing chained IRQ handler"). Based on the mail discussion, it seems ok to drop the error handling. Link: https://lore.kernel.org/r/20210115212435.19940-3-martin@kaiser.cx Signed-off-by: Martin Kaiser Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin --- drivers/pci/controller/pci-xgene-msi.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/pci-xgene-msi.c b/drivers/pci/controller/pci-xgene-msi.c index 2470782cb01a..1c34c897a7e2 100644 --- a/drivers/pci/controller/pci-xgene-msi.c +++ b/drivers/pci/controller/pci-xgene-msi.c @@ -384,13 +384,9 @@ static int xgene_msi_hwirq_alloc(unsigned int cpu) if (!msi_group->gic_irq) continue; - irq_set_chained_handler(msi_group->gic_irq, - xgene_msi_isr); - err = irq_set_handler_data(msi_group->gic_irq, msi_group); - if (err) { - pr_err("failed to register GIC IRQ handler\n"); - return -EINVAL; - } + irq_set_chained_handler_and_data(msi_group->gic_irq, + xgene_msi_isr, msi_group); + /* * Statically allocate MSI GIC IRQs to each CPU core. * With 8-core X-Gene v1, 2 MSI GIC IRQs are allocated -- 2.30.1