From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C4FCEC433F5 for ; Fri, 7 Jan 2022 19:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/rHkpnqvMAGm/8phqDptORD95QeU45XliD5eumQNP78=; b=Q9gqEADmZN5qM0 SYmDAcyKZaBX+QdXs0smHLBgabYO0k6a3yRFEr4aFCfspOlQNEMuMmQj/fKB4bg0WtKE229RbNke+ ywOlWUFaqHgC7SZhNd35BspbmaZmk+ZlcJ0tDMsNN23OT0bnxh51sxf6Ay3fGdL3SeMVi9jgUDfm4 mMMveSBtZN8yKkQY4bh5uqWituv2x7FRAUM3w5iWMJxtEmpC3K+c5yN/HJMcpMfI9Pfjin4Li9Rsn Zw3dqCYqu2OYniOR8pLRJ0CtacEnlS0puU1zm8bdWqJUg4Hwf5QL0D1+zpYXb5ADPGVYxE3fSkvA9 Tgq7Xt5bUNLckCw3LrFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5uiF-0053ZE-It; Fri, 07 Jan 2022 19:15:43 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5uiA-0053X6-N6 for linux-arm-kernel@lists.infradead.org; Fri, 07 Jan 2022 19:15:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=grgsnELUEXZnuUjrVS4f5sHoasCVsBVCh9f+iJP67pA=; b=dHj0fodlh3VfjeW9VmH2pxwZSR 7Tn/gYIelKp6SQ/rG6Giu0IP4YvsNoWg3wXG+/OV//NQ+/8OBMcBCBiD8cCs3YUJ/WQgUvH2bNhXE ISsP1V9AYlmg8ibVTX6h93pCfKoaIfqrDtkTrkV3ghkwC4T4vHkJay8QF06RtEmzuQh6IIWzkL29w sa+gDnOytbBfSnQd+4cSBrFnu+wSAKuBXXzWGqCpONLnRf0tJ0zJFcPxWposgxZ+6LCIaumSme3XA 9JfR3pC4JGLCdRgY1yhJANs6P9hd3blMI1kE8agwZP1hllfTLaVsCRiG98MljmV8B/8ouTHW0pWde aATHLDZw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:56622) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1n5ui0-0001k1-TT; Fri, 07 Jan 2022 19:15:28 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1n5uhy-00029p-BZ; Fri, 07 Jan 2022 19:15:26 +0000 Date: Fri, 7 Jan 2022 19:15:26 +0000 From: "Russell King (Oracle)" To: Bjorn Helgaas Cc: Pali =?iso-8859-1?Q?Roh=E1r?= , Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Marek =?iso-8859-1?Q?Beh=FAn?= , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 04/15] PCI: mvebu: Handle invalid size of read config request Message-ID: References: <20211125124605.25915-5-pali@kernel.org> <20220107184548.GA390934@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220107184548.GA390934@bhelgaas> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220107_111538_803398_07E7FF16 X-CRM114-Status: GOOD ( 22.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jan 07, 2022 at 12:45:48PM -0600, Bjorn Helgaas wrote: > On Thu, Nov 25, 2021 at 01:45:54PM +0100, Pali Roh=E1r wrote: > > Function mvebu_pcie_hw_rd_conf() does not handle invalid size. So corre= ctly > > set read value to all-ones and return appropriate error return value > > PCIBIOS_BAD_REGISTER_NUMBER like in mvebu_pcie_hw_wr_conf() function. > > = > > Signed-off-by: Pali Roh=E1r > > Cc: stable@vger.kernel.org > = > Is there a bug that this fixes? If not, I would drop the stable tag > (as I see Lorenzo already did, thanks!). > = > > --- > > drivers/pci/controller/pci-mvebu.c | 3 +++ > > 1 file changed, 3 insertions(+) > > = > > diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controlle= r/pci-mvebu.c > > index 08274132cdfb..19c6ee298442 100644 > > --- a/drivers/pci/controller/pci-mvebu.c > > +++ b/drivers/pci/controller/pci-mvebu.c > > @@ -261,6 +261,9 @@ static int mvebu_pcie_hw_rd_conf(struct mvebu_pcie_= port *port, > > case 4: > > *val =3D readl_relaxed(conf_data); > > break; > > + default: > > + *val =3D 0xffffffff; > > + return PCIBIOS_BAD_REGISTER_NUMBER; > = > Might be the right thing to do, but there are many config accessors > that do not set *val to ~0 before returning > PCIBIOS_BAD_REGISTER_NUMBER: I think a better question would be - how can this function be called with a size that isn't 1, 2 or 4? I suppose if someone were to add another PCI_OP_READ/PCI_OP_WRITE. However... they really need to audit every implementation if they do that. The generic implementation does this: if (size =3D=3D 1) *val =3D readb(addr); else if (size =3D=3D 2) *val =3D readw(addr); else *val =3D readl(addr); and therefore completely ignores the size if it isn't 1 or 2. So I don't think this is something that needs fixing. If we're going to fix this in drivers, shouldn't we fix the generic implementation too? -- = RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel