Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2916316pxb; Tue, 24 Aug 2021 10:31:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6qucBgNK09Wey/hj9U3MFRph/9AnWV/pkyQHt/d8twvwXpZ51rGX95rB9KC0xeOFQmLSP X-Received: by 2002:a05:6602:d9:: with SMTP id z25mr32395578ioe.154.1629826291801; Tue, 24 Aug 2021 10:31:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629826291; cv=none; d=google.com; s=arc-20160816; b=o0HjXCBuWsdwelcgLA6U0j27PwNpnlemZ/+9crNx/uaR47oV0x5QBZ3NDzQXoZ7YvD ANgIX/d3RlF9UmfUvXVq5k7dTWKiKzEYVaz8tJBPybi7IkeUz5vpEL3UwqJ5U8bwg6bC peNddh6nuHxjssdiuHtyNhSlqII2d2y+QzwDlMGXd8H9IwF8zOgCsh+T1QIgWf6CK/Ht OEDkoej0UcFLVSSrhjWfmd7TPGynwlzj/i/MclHMmJwFKwclCMaZkJh7AhmswZgaV3OM fpQ1az6XcCThRIFVUkaqcODelIhYd++JYaM6O6v4y5yslS1dC6aLvBjnLvfdoAdliXlu SaSw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W0MYtpfXsB+v3FB909tKqm9qcn36x5C0p4Sldo3O0TU=; b=nz8aJNnRzp096kfJZVKbry3OD5bPPTy0LAP0WIVQspStOzazBX5ULQ5F3YrvkCCPke Qr8MI/wCk4dMm5XeF12cVTH2btd/+SwppvT5qAnO/O1WXzl4WNt5fL03scAdAjJoEAjm GLGTKo9PDuai6xPiGMyeQ+y0RPs8BP3mNbeuFNnfDLV6/PON4Xbs/QhIXtanF9dWB2e6 /5hyncYvOXjf/RHPokWKXUThn3cCjoP23gjlPUmiHP7itoIhEjJIm18WfW2C1kd/kXso hZivJawmUcTXOuAFGh+54+iQsaq51Wj5Q4BFpaK/Uumeo9Cf6RJe6gjEDDQv1oWZsGyG Av+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YjrojIQq; 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 q74si12821214iod.9.2021.08.24.10.31.19; Tue, 24 Aug 2021 10:31:31 -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=@kernel.org header.s=k20201202 header.b=YjrojIQq; 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 S240699AbhHXRaa (ORCPT + 99 others); Tue, 24 Aug 2021 13:30:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:35178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240146AbhHXR2T (ORCPT ); Tue, 24 Aug 2021 13:28:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC9F861B60; Tue, 24 Aug 2021 17:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824720; bh=TjxjeoL/OU23aSoVTktLXcmKLGPvsR3tj6InLPnctz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YjrojIQq8T7a03zjJIWnWwVaiOHKGcw2zMCTuV0QXk1jMfBtAl/CyBN4Jy3w0/21w i+EIZQcazHyZOnIwQb6TGuF0ucKf65459LUjAG/HU2oDgaTXFRmscDODgFPGbX37og u+581Na0I4i0Zigf3Z+EFQQV2n0lDAeoZH0F0B7NqmGQQHkYO+Z12Y4pyF5MnxMPJY ceHS7N+mRlLmbAtiQuUVnbAmMztLIyfhMetb5FzozkO6l5Bjt6YYTwXk4TmVzYicz0 NdIkZjfP6NT0DzM/INq1Sd3zl0aPZfsQ/af+2sXWdzI7ZI4oufuQnyRBrmYWHwh6Xo wB4RHKAlAyUyg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Thomas Gleixner , Marc Zyngier , Greg Kroah-Hartman Subject: [PATCH 4.14 22/64] PCI/MSI: Do not set invalid bits in MSI mask Date: Tue, 24 Aug 2021 13:04:15 -0400 Message-Id: <20210824170457.710623-23-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170457.710623-1-sashal@kernel.org> References: <20210824170457.710623-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.245-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.245-rc1 X-KernelTest-Deadline: 2021-08-26T17:04+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner commit 361fd37397f77578735907341579397d5bed0a2d upstream. msi_mask_irq() takes a mask and a flags argument. The mask argument is used to mask out bits from the cached mask and the flags argument to set bits. Some places invoke it with a flags argument which sets bits which are not used by the device, i.e. when the device supports up to 8 vectors a full unmask in some places sets the mask to 0xFFFFFF00. While devices probably do not care, it's still bad practice. Fixes: 7ba1930db02f ("PCI MSI: Unmask MSI if setup failed") Signed-off-by: Thomas Gleixner Tested-by: Marc Zyngier Reviewed-by: Marc Zyngier Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210729222542.568173099@linutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/pci/msi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 2c7766c87a4d..c69cd0dff301 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -619,21 +619,21 @@ static int msi_capability_init(struct pci_dev *dev, int nvec, /* Configure MSI capability structure */ ret = pci_msi_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI); if (ret) { - msi_mask_irq(entry, mask, ~mask); + msi_mask_irq(entry, mask, 0); free_msi_irqs(dev); return ret; } ret = msi_verify_entries(dev); if (ret) { - msi_mask_irq(entry, mask, ~mask); + msi_mask_irq(entry, mask, 0); free_msi_irqs(dev); return ret; } ret = populate_msi_sysfs(dev); if (ret) { - msi_mask_irq(entry, mask, ~mask); + msi_mask_irq(entry, mask, 0); free_msi_irqs(dev); return ret; } @@ -897,7 +897,7 @@ static void pci_msi_shutdown(struct pci_dev *dev) /* Return the device with MSI unmasked as initial states */ mask = msi_mask(desc->msi_attrib.multi_cap); /* Keep cached state to be restored */ - __pci_msi_desc_mask_irq(desc, mask, ~mask); + __pci_msi_desc_mask_irq(desc, mask, 0); /* Restore dev->irq to its default pin-assertion irq */ dev->irq = desc->msi_attrib.default_irq; -- 2.30.2