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 BFF36C433FE for ; Fri, 7 Jan 2022 18:46:59 +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: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:References: List-Owner; bh=AexQIK7Gdlih/CRj4vxJ9w0GgFi/x3YSf9Pne+9glGY=; b=CVfhAaEp6hozJD ApXqoZhv05Y31lB+KpW/AEvBmH8ZkrJgZfpz3J6EzcbzBsQ2SIO4XlJ3n+tAzmia7rxMrWfZD6vGP r4fK2RrDdpFxH47s1Amc1xYAbAFqjdu/IT40Drp/xNQj4xLxZdrMOTmAkzgqQzFjkn+IJBFaWZq4z CxyExLgDCBRfgKdn0d5DqWCQMnUAwA/tZSXwk8rpQLWXjN4qYZPb0JBCc+n2RP295/hOO+ycSAFK2 6tj+OHwd8ZsdN3/xtKn098bDgTyOr0zr9tUWvc3bC2phfE0ql6B3wwk2aBDWd+CmLbI0D8ky91bme 94PibdoS/GTt/TZrI9dw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5uFV-004vsG-37; Fri, 07 Jan 2022 18:46:01 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5uFM-004vqE-4z for linux-arm-kernel@lists.infradead.org; Fri, 07 Jan 2022 18:45:53 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AE9EB61720; Fri, 7 Jan 2022 18:45:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4C3BC36AE9; Fri, 7 Jan 2022 18:45:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641581150; bh=ldytF5XvdxNK25AZ/Rg8qis5NU/+Yn1ZpYM0pkB0Gdo=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=jlD4gPcExL33TD3RD5A3nYCDHSnixX9+PDt9isYN1GMzPah1POJVkEYto52BrCKab JPEq+L2/1tkyOmdohrl+MxGV0MjO5iQ8GzbqokF91D2cZGl+/f4jievzZMj1t6xPkC uW2WgTCrgM1ChY9nCpESLYXq/HX0gjZcURkcP/3PGn9P1e6f0NPUJW/AA/Kuu2q08p lkFjRAv3UY+zUyvxxnlo+CuiL4Z38yvaqjSunxXmC1m6ZBYa6zEW+c2RTwSeK86PQC IMmX68TUeOLGrqHr6vYKMC63w7CyU538LQx01ZM7qIuGvkhJujy2Oh45Ywkl4gM6EQ 2KVRxASnQManw== Date: Fri, 7 Jan 2022 12:45:48 -0600 From: Bjorn Helgaas To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: 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: <20220107184548.GA390934@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211125124605.25915-5-pali@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220107_104552_297381_D956E9B7 X-CRM114-Status: GOOD ( 19.12 ) 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 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 correct= ly > 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/controller/= 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_po= rt *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: pci_bus_read_config_byte (and word, dword) # PCI_OP_READ(), *val unchang= ed pci_generic_config_read # *val =3D 32-bit value pci_user_read_config_byte (...) # PCI_USER_READ_CONFIG(), *va= l unchanged sh7786_pcie_read # *val unchanged dw_pcie_read # *val =3D 0 mobiveil_pcie_read # *val =3D 0 faraday_raw_pci_read_config # *val =3D 32-bit value ixp4xx_pci_read_config # *val unchanged orion5x_pci_hw_rd_conf # *val =3D 32-bit value orion_pcie_rd_conf # *val =3D 32-bit value bonito64_pcibios_read # *val =3D 32-bit value loongson_pcibios_read # *val =3D 32-bit value msc_pcibios_read # *val =3D 32-bit value ar724x_pci_read # *val unchanged bcm1480_pcibios_read # *val =3D 32-bit value _altera_pcie_cfg_read # *val =3D 32-bit value rockchip_pcie_rd_own_conf # *val =3D 0 rockchip_pcie_rd_other_conf # *val =3D 0 pci_bridge_emul_conf_read # may depend on op? There are more, but I got tired of looking. I actually didn't see any that set *val to ~0. I think the check in PCI_OP_READ() means that most accessors will never see an invalid "size". > } > = > return PCIBIOS_SUCCESSFUL; > -- = > 2.20.1 > = _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel