From patchwork Thu Nov 25 12:45:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12693653 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 D0621C433EF for ; Thu, 25 Nov 2021 12:50:17 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZYmj87Kd1riE3vLYfahhgOItK6fRxjWxf6XblrbU3pc=; b=isXXO+9hBJLKgc AYK8SmyhRrVCSka4i5GVcVnMV4mwwvJsKtBAFh0+fUJSA1rlfJgwF3oJ1E4Y/Jb3bv8lvI0wIpFrL lyM2IQ7Fwc8cSSmMeSUQgEy5kKNpLP34VP2rixgH49/qTteAcJpfY/dYVvwIydD7M38TJcPKY1Xct XCtMppuGzp66EaTRJlVSROVzcLf/wCC8AuPhrjbngQbKE+VwbNeB+8NrR/d1HPUHlGiXeuA69GMzD Tawk7PDKahIlH0sDzhBBx0ZHaB96cjmGvpeiUwpJW9b1Jhd2dDJxIm7doRNr9oqSgFO+cnT5B/Rjx c9j7gNBsOK6lVZUc4T2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqEAg-007TJK-Kq; Thu, 25 Nov 2021 12:48:15 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqE95-007SoG-Kv for linux-arm-kernel@lists.infradead.org; Thu, 25 Nov 2021 12:46:38 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 14572610FB; Thu, 25 Nov 2021 12:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637844395; bh=V49Dl6I3ETYyBXCva0Ab5YRCPF20sbpwGL5aEs5sgZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kvm31VUlPXoPnaVkKfH4RfPkFELOCasP8eM7ZRiPWKDrUYF7fe5tvMMhhoU+fzDiL 7SzZkIR9yvX9tPU7K3+kjN21luO04b9pUjXPL5Cw7ylhZOaGVHSIlqrLL8z4kC744P 5N1xI0mTznUKsgoDU6uyKayGJmQqqdWNSaQD9oOqNTZHMXhEKygg/PmVSu9R1yhrIa 86E47HhNcRElH1tekn2OEFdJav3JxOh0pctuDBBBaF6lY/oxwLRcqFSVQb1Rx86Uqj t9PNgSBTw2pKnN768RVJIz5Y/1Ag84yCWZdkqzRhRE+KelYvIrbd2DfTeFXTJ5JGof To1vc5sTxiVaA== Received: by pali.im (Postfix) id 6C55467E; Thu, 25 Nov 2021 13:46:34 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , =?utf-8?q?Marek_Beh=C3=BAn?= Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/15] PCI: mvebu: Handle invalid size of read config request Date: Thu, 25 Nov 2021 13:45:54 +0100 Message-Id: <20211125124605.25915-5-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211125124605.25915-1-pali@kernel.org> References: <20211125124605.25915-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211125_044635_752982_49BD0EEA X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Function mvebu_pcie_hw_rd_conf() does not handle invalid size. So correctly 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ár Cc: stable@vger.kernel.org --- 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_port *port, case 4: *val = readl_relaxed(conf_data); break; + default: + *val = 0xffffffff; + return PCIBIOS_BAD_REGISTER_NUMBER; } return PCIBIOS_SUCCESSFUL;