From patchwork Fri Jan 24 09:30:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 232930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC92DC2D0DB for ; Fri, 24 Jan 2020 11:26:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B294C20718 for ; Fri, 24 Jan 2020 11:26:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579865213; bh=CHakN+mBFNg7zyA+oUB7U/ojbnS3nlpGBy8uEgjSruU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=S8saCbmyqAHSqPdD63RF2tKPnOD2UxRijSSevbjTQ8tSHgCp6saK6B4kHJW18i9dg Laf5jjTVwDw//TjJumyGNTIaO7+HCU5jEScSv4F6XUxf9VPXmJKups7MGRBBkQ4p/t rTtnKkpppMlVm2brjDEz5Y8cOWt/WV0DWcEf5/e0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388660AbgAXL0w (ORCPT ); Fri, 24 Jan 2020 06:26:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:41964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391469AbgAXL0u (ORCPT ); Fri, 24 Jan 2020 06:26:50 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D6E2620718; Fri, 24 Jan 2020 11:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579865209; bh=CHakN+mBFNg7zyA+oUB7U/ojbnS3nlpGBy8uEgjSruU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WKCxgz+W1P2OE1p9s+ZWPcUa2pSg/nYZxSOLa+zNTA/CxZYgEcDBr7J2sTlu7xkf8 EcpXaAR2r1uZQKeYdNIhKlPzsukhhkUNY8e8T+INRMxBQG7wXxzUVqh9tA5IFuvN9g j48mWDigvUDxbcltL2HfWb5dpJqTakc0UKVVwAdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Zhiqiang , Lorenzo Pieralisi , Minghuan Lian , Sasha Levin Subject: [PATCH 4.19 470/639] PCI: mobiveil: Fix devfn check in mobiveil_pcie_valid_device() Date: Fri, 24 Jan 2020 10:30:40 +0100 Message-Id: <20200124093146.309905812@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hou Zhiqiang [ Upstream commit cbd50b3ca3964c79dac65fda277637577e029e8c ] Current check for devfn number in mobiveil_pci_valid_device() is wrong in that it flags as invalid functions present in PCI device 0 in the root bus while it is perfectly valid to access all functions in PCI device 0 in the root bus. Update the check in mobiveil_pci_valid_device() to fix the issue. Fixes: 9af6bcb11e12 ("PCI: mobiveil: Add Mobiveil PCIe Host Bridge IP driver") Signed-off-by: Hou Zhiqiang Signed-off-by: Lorenzo Pieralisi Reviewed-by: Minghuan Lian Signed-off-by: Sasha Levin --- drivers/pci/controller/pcie-mobiveil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c index dc228eb500edd..476be4f3c7f6e 100644 --- a/drivers/pci/controller/pcie-mobiveil.c +++ b/drivers/pci/controller/pcie-mobiveil.c @@ -174,7 +174,7 @@ static bool mobiveil_pcie_valid_device(struct pci_bus *bus, unsigned int devfn) * Do not read more than one device on the bus directly * attached to RC */ - if ((bus->primary == pcie->root_bus_nr) && (devfn > 0)) + if ((bus->primary == pcie->root_bus_nr) && (PCI_SLOT(devfn) > 0)) return false; return true;