Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3524921pxf; Mon, 15 Mar 2021 11:29:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfDAtCt4JoCfZjHg6oIVO2faaNquD21gs6xAXbfRMkj0Ntckt8uwoGC1y8e/iwsRY/XM8R X-Received: by 2002:a17:906:a86:: with SMTP id y6mr25713061ejf.354.1615832959933; Mon, 15 Mar 2021 11:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832959; cv=none; d=google.com; s=arc-20160816; b=Z1ZXBunvYSA7mA4pXy2K/Y51Bm9oCE6I3ToRStIdtBvSUUH8lKqOHuKLNW7mdgmKA0 hU4Y02Vt4ZPiHur0l2FjGNsRKcAMAduvePNO/iGcm+F6Is+Qir9d8XfU1+RYjpSR0nrx 5pem++S3XK+R06pSUHyTA5TiCU48Hk/yRRBB2XNm3WOPxxhUEDW+zIg7t7PqInftl56w 4piXrQvAOL7CDq0UV7OL3xWv+IAFO6Hn48TMq+LQr4NcxtcqdTCDd+ABiUcXTKLXo2xw 4EPA5UCWOVCgJpugtYGh+Nnmd7kTXbddoKrx7ABvb7Cv4kvVBwjrWe8RijcQoQpKd6u8 CkrA== 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=E8Cie6PvVxsNbOhD//Blbs+nACv366xyEoFFk78394h+3btV22L1xSKHIuONmcZdeI qV30FOkADEwbsrtTwSEYv8JQvxz5DJPsoE0BUWsZ6K0Yg4amJyn5qWlrVUk/gbn2Hn1R VVi/RmuCLZIwFAE9zo6p0kE6mWuDbVP+ec+A1XBSHCylMHDRnbeHfad1Go/X4LeWH9XN Y0MiCUiPA6C0oxnhQ1DtoTzxtfhHdGZ0Z3ZjHn2zEygC1oH+X0MBZJ2GYI838wun80Sw n5KW/JuRZ0Jget7ujGaiAVtDvwkapAn3C6LADWO29AgtdB6r9Gu7D7PpvCNPpPND6rhL OegA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QKMJ+DxH; 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 x11si10764125edd.260.2021.03.15.11.28.49; Mon, 15 Mar 2021 11:29:19 -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=QKMJ+DxH; 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 S239961AbhCOOdU (ORCPT + 99 others); Mon, 15 Mar 2021 10:33:20 -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 S233251AbhCOOBN (ORCPT ); Mon, 15 Mar 2021 10:01:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6085264F35; Mon, 15 Mar 2021 14:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816851; bh=d+4xpJa7BJFumZ5sJgfSVbsuYD7yrrx4k1xWh1nF4t4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QKMJ+DxHPV9yO1w5geWtiObDGAJKm437o1SnOoo0jWUgbw5xgGlwm56ZXRW0mErda P9U3g50HVp4FXr5wnT2sVELB6zn2LnrxZXKi0neVhyC3OrbAtgph4100Aw9cBRoH5R c5AgNcQ9pSY1TDAEtiUS5pPv8WuIEREbFM7Q9MCI= 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.10 151/290] PCI: xgene-msi: Fix race in installing chained irq handler Date: Mon, 15 Mar 2021 14:54:04 +0100 Message-Id: <20210315135547.025790357@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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