Message ID | 20221121083325.898535631@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1626524wrr; Mon, 21 Nov 2022 06:37:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf6W1HpVB9/cnmeex36M+2IwxEfYE/M2axM7s8IRxw3o7Pd8+RaxG6MpR4DVdp0FBBhJnF5Z X-Received: by 2002:a62:8686:0:b0:56c:636a:ac94 with SMTP id x128-20020a628686000000b0056c636aac94mr312322pfd.38.1669041471129; Mon, 21 Nov 2022 06:37:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669041471; cv=none; d=google.com; s=arc-20160816; b=AoqApVRx+tro/nsxK6b2ZzQ51ubowp7z9qFCDn2xaYYR51PxSL7MlDlW1MUkhWfdJB czehgyfp+km6D23c2r1rJvlKfd4RH6Iah36G2ksruQy51i5+a0RqQ1eU+BanysUkDlj/ a1jfPs62hzrykG87+pAdQ32WeTzUU/oIX8C+cBv2MvAn1wqYuRZVxOb4jgHBIneWPVVs pf1aEvMgGXH1L0kDCcaw08brUUSQE1GMNBwQtb8gwYhqrilJZc7jwS3mbd2YhKg3dVAT VFkSQjCnuQb3/cusPOIGzIB23S+J+lvTy8njFiGxz80AtVTa59ydsIFxJTeVD7xlkzbc HC2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=9rEv0ZCHRcbwfGXHvRaB+26Gs3i0vHsf2KEnMS96bjY=; b=ZVbN912+T0kTre7O2OwzkqmJfwUUjufd8V5iu5JXyn0TvhRs88/4s6JboLY3GTveyu 2nRPIkPcfMznPqUumyBLeMUYnR6x2arHjAWU7ZAeKIp5ea/bPzJntkcmftp3OGXUH4mM Qy/8NLcxBX0/jA/nLurA4R4Hm+BLWT9Xsh+lxlGZKFl6rEy0PN2vYMV+kU/etGp0z5Nn lh3uCYEHVIXwfo4lBC0HwS+ZFwsdqrcQCnhPJTQ6x1dT61xIJX7UqdBGZLdh2NP9ZVDR Aj2jIMFNksyXPJUgX/sXUcpCX0fRcrS8FRnSXp1CWdjCeT6M2kuTcNpCDX4eey+kGUit avZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GXvys4RN; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f21-20020a056a0022d500b0056bc627dbeesi11878335pfj.124.2022.11.21.06.37.36; Mon, 21 Nov 2022 06:37:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GXvys4RN; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231178AbiKUOhR (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Mon, 21 Nov 2022 09:37:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231272AbiKUOgl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 21 Nov 2022 09:36:41 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A504DC6D13; Mon, 21 Nov 2022 06:36:28 -0800 (PST) Message-ID: <20221121083325.898535631@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669041387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=9rEv0ZCHRcbwfGXHvRaB+26Gs3i0vHsf2KEnMS96bjY=; b=GXvys4RNHQ7h0QJBqveM//QK3VblBKRZ4eYHP/cRMku42RLzjX3JH3BHs7zUb5U/ORz0Qn N/TjGTvzSeYuMzUs3dVZUk7xyyDqIZD7+dy/qhNkL/ggGFqlVZb4G+lODo4RrmjkA0pLsE DXFG8m0zubDhD9Qz+DOsxZR6jxULosiRgtLhI3HKwk3k601W1wPVdNf9bvxFOndczykdZW PLQMuQ9BMlXYsARIKsuQCR0r5ZuInW1CMdeYh/vRpwlFsPwFiIVT/UZe7GSZ53s870/4pS ZJp3wL0ucDww9DednLFrLw2+oEbJVvjebsyGeh7/YoO/rYDFIXSVqTGyIvWsyQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669041387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=9rEv0ZCHRcbwfGXHvRaB+26Gs3i0vHsf2KEnMS96bjY=; b=/ryo2wZZtD3zkaTdpxsEJC9pzfQODO2gG/rLr9x6xv7NCtw5ssyjyawTKgkSyCSIBjSgiM iNZJtqjUellQKGCw== From: Thomas Gleixner <tglx@linutronix.de> To: LKML <linux-kernel@vger.kernel.org> Cc: x86@kernel.org, Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>, linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, Marc Zyngier <maz@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jason Gunthorpe <jgg@mellanox.com>, Dave Jiang <dave.jiang@intel.com>, Alex Williamson <alex.williamson@redhat.com>, Kevin Tian <kevin.tian@intel.com>, Dan Williams <dan.j.williams@intel.com>, Logan Gunthorpe <logang@deltatee.com>, Ashok Raj <ashok.raj@intel.com>, Jon Mason <jdmason@kudzu.us>, Allen Hubbe <allenbh@gmail.com> Subject: [patch V2 07/21] genirq/msi: Check for invalid MSI parent domain usage References: <20221121083210.309161925@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Mon, 21 Nov 2022 15:36:27 +0100 (CET) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750116829889827500?= X-GMAIL-MSGID: =?utf-8?q?1750116829889827500?= |
Series |
genirq, PCI/MSI: Support for per device MSI and PCI/IMS - Part 2 API rework
|
|
Commit Message
Thomas Gleixner
Nov. 21, 2022, 2:36 p.m. UTC
In the upcoming per device MSI domain concept the MSI parent domains are
not allowed to be used as regular MSI domains where the MSI allocation/free
operations are applicable.
Add appropriate checks.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
V2: Made the error return understandable. (Kevin)
---
kernel/irq/msi.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
--- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -937,13 +937,21 @@ int msi_domain_alloc_irqs_descs_locked(s lockdep_assert_held(&dev->msi.data->mutex); + if (WARN_ON_ONCE(irq_domain_is_msi_parent(domain))) { + ret = -EINVAL; + goto free; + } + + /* Frees allocated descriptors in case of failure. */ ret = msi_domain_add_simple_msi_descs(info, dev, nvec); if (ret) - return ret; + goto free; ret = ops->domain_alloc_irqs(domain, dev, nvec); - if (ret) - msi_domain_free_irqs_descs_locked(domain, dev); + if (!ret) + return 0; +free: + msi_domain_free_irqs_descs_locked(domain, dev); return ret; } @@ -1013,6 +1021,9 @@ void msi_domain_free_irqs_descs_locked(s lockdep_assert_held(&dev->msi.data->mutex); + if (WARN_ON_ONCE(irq_domain_is_msi_parent(domain))) + return; + ops->domain_free_irqs(domain, dev); if (ops->msi_post_free) ops->msi_post_free(domain, dev);