Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3518039pxf; Mon, 15 Mar 2021 11:19:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMOKEcVv6JcWNyAcLsPrPk4BvxuWRdVaQOD9HADOPt0C/27Q4x4I/18b4ECKzsD9nsMfj6 X-Received: by 2002:a17:906:bc81:: with SMTP id lv1mr25223100ejb.135.1615832351440; Mon, 15 Mar 2021 11:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832351; cv=none; d=google.com; s=arc-20160816; b=JjAMKI9MUYzzH/X4Y1xznAygOz3r4+jfad5qHSYNvNaqVbGAPedrcEY3WG0WOLHUJi Eo0EPy043fg9njs2JKcWSKUzq7Lr6RYMTVdihMCLI69+Qzl9+jbA5VZhpWl3JcYfiwMf J8ynrPSnrqvx5CQC5tfnPYz2FAhE0lWDWGGO3okE/evKCKQV50ejYCGUsKuGQ9UP+R2F OBRIqfYJB/79waNhcPGarGfekgdeheFvtaDt8wwMMAUbiGZSnlW6GVq06B2TGeZKkEeO rxnTTZdd4COLRa7Nv7dwLrOp/17QJtkzBoPOQGeY/oACcMpd7dOBWf4tn5ETvRjPGQX2 I6IQ== 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=pGFPA3TkaueTa0YfDAho3wPhIgTQ0iveunDpkyN4FYI=; b=p3vO0C9LDfWA1hPrZG4NfB55iC4Ip4cgtO9t6lPKbcwFxgrIuqHzwUheGXhjf3N/1R ONEPzHZGA3+nK4jF43CaXgL+DD1L9D3p3DAhjHA3B9t98FFG3/jaF/Wfbb2kJ7OLgo5f Ob9LGQOIU74zWotjW6RIHvSbmikQqzkdQBgafAIuxnEwX7rDhG6sM2OdffVJ+2l81315 IyQbolzxX3C69aITPHhvuq8wGUlXZ60jlYocjYCC0Q6RE6z4m1hTJKyCCvNvdCA4M01v Ac1DDyElwlu+LMdY80rLEbK2x2cq00Td/JjWdbulUPDGuxBTtDDS3Rv5udRRcHUDUPQY i0eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qZtfGnnf; 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 z2si2116945eju.371.2021.03.15.11.18.49; Mon, 15 Mar 2021 11:19:11 -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=qZtfGnnf; 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 S237349AbhCOORl (ORCPT + 99 others); Mon, 15 Mar 2021 10:17:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:36788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232749AbhCON7i (ORCPT ); Mon, 15 Mar 2021 09:59:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BA9ED64F70; Mon, 15 Mar 2021 13:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816761; bh=tgZj3yqf/KXD+4wRT62Trdip7UIaBMoObbf1nVfldlg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qZtfGnnfMl6ppZHJvs5ZeOLXII5gr9j6kzjDUkixH6DnDpmLPlcbEd5MdHYzqL5l+ +DtgHUPD8qp0G11le2GNjQpTzIxxmj6yyAv606oZGlY8sFpJN0JTKoidXy5NCLfo3v DaQA/0rWbkM4QWX+DNsgw3z5YgXOV+bq78PY/KB8= 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 4.19 051/120] PCI: xgene-msi: Fix race in installing chained irq handler Date: Mon, 15 Mar 2021 14:56:42 +0100 Message-Id: <20210315135721.657402425@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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 f4c02da84e59..0bfa5065b440 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