[{"id":3686746,"web_url":"http://patchwork.ozlabs.org/comment/3686746/","msgid":"<20260505222018.9CAC9C2BCB4@smtp.kernel.org>","list_archive_url":null,"date":"2026-05-05T22:20:18","subject":"Re: [PATCH v15 3/7] PCI: Fail FLR when config space is inaccessible","submitter":{"id":93311,"url":"http://patchwork.ozlabs.org/api/people/93311/","name":null,"email":"sashiko-bot@kernel.org"},"content":"Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:\n- [High] Logic flaw: pci_dev_config_accessible() executed before the probe check can permanently disable the FLR capability.\n--\n\ncommit dc74511c4dd4719d1b362bacdaab4c551ada9e66\nAuthor: Farhan Ali <alifm@linux.ibm.com>\n\nPCI: Fail FLR when config space is inaccessible\n\nThis commit adds a check to validate if a device's config space is accessible\nbefore attempting an FLR reset. This is intended to fail the FLR early when\nthe device is in an error state.\n\n> If a device is in an error state, then it's config space may not be\n> accssible.\n\nThis isn't a bug, but there are a couple of typos here (\"it's\" instead of\n\"its\", and \"accssible\" instead of \"accessible\").\n\n> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c\n> index e71b814153921..c50418f5e3181 100644\n> --- a/drivers/pci/pci.c\n> +++ b/drivers/pci/pci.c\n> @@ -4396,6 +4396,9 @@ int pcie_reset_flr(struct pci_dev *dev, bool probe)\n>  \tif (!(dev->devcap & PCI_EXP_DEVCAP_FLR))\n>  \t\treturn -ENOTTY;\n>  \n> +\tif (!pci_dev_config_accessible(dev, \"FLR\"))\n> +\t\treturn -ENOTTY;\n> +\n>  \tif (probe)\n>  \t\treturn 0;\n\nCould this placement cause the FLR capability to be permanently disabled if\nthe device is temporarily inaccessible during discovery?\n\npcie_reset_flr() is called with probe == true during device initialization\nto discover if the hardware inherently supports FLR. By placing the live\nconfig space check before the probe check, the system will actively read the\nPCI_COMMAND register during capability discovery.\n\nIf the device happens to be temporarily inaccessible during this probe phase,\nit will return -ENOTTY and FLR will be permanently omitted from the device's\nreset_methods array.\n\nWould it make sense to move the pci_dev_config_accessible() check after the\nif (probe) block so we only check accessibility when actually performing the\nreset?","headers":{"Return-Path":"\n <linux-pci+bounces-53807-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=nxfVAnv4;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-53807-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"nxfVAnv4\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g9CdH2r42z1yJV\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 08:20:35 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id B98F73034BF6\n\tfor <incoming@patchwork.ozlabs.org>; Tue,  5 May 2026 22:20:19 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 341E7345736;\n\tTue,  5 May 2026 22:20:19 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 1100131716D\n\tfor <linux-pci@vger.kernel.org>; Tue,  5 May 2026 22:20:18 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 9CAC9C2BCB4;\n\tTue,  5 May 2026 22:20:18 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1778019619; cv=none;\n b=MLsxMzY9ZLcx2oXxAQBoywz2z12G+MAO2IurcefND6fA7JeUXEF2RuKlHIQ5mFRVXxcNDImvbyvibs3hpO+s0nYZiw/T0OEJjc7lAdv8DuNmQUt6nGPBS1Jq/bMN0BNGpFljq35bSlqTw+klWyHZAMEZvbbwBgR6pK1udG/Pavk=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1778019619; c=relaxed/simple;\n\tbh=aPMcybPhX6e+NurQaHVI/qlRUWpWRGi6ehPsEe+2Kks=;\n\th=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Date:\n\t Message-Id;\n b=elI+UpeDVUuyw0GLLajxw7imRW9Sw2Rgb7fnu+NE37ooH/t9SNwPNOQ27MVpA2/kj9/8tgcecOnSd/A9Yma/VQRUI7DZ3+pkyI6M9AhgFXwwCbQGT6+8BHQFUToWa++pktxM7C9CWJjWERu2MNT7qx7MNHJuZCIYiJK6+lx/wEk=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=nxfVAnv4; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1778019618;\n\tbh=aPMcybPhX6e+NurQaHVI/qlRUWpWRGi6ehPsEe+2Kks=;\n\th=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date:From;\n\tb=nxfVAnv449sKRPSYU/aCLSmAh5cNp9ZnLMMi4LyeTjySKOJUM/ZIiAV5eT8faAY+O\n\t 4QFdCr8maxjRkFEST1GyRK3lWFy6zpVkkg5IkvFs6rFzVSScxchx5AjmUkC9DjJqFM\n\t neTAYXhlsFQNpWimFnTF6wRUs8b7ii8Kl/ICeHmp9LHqCXUgyL1nsZH3R6xQ6AMZ9d\n\t Yg7y93pEtFF2X2tHVUIp7t0ZMETHqsaw0sVPU+N7uPFZdurO6irKf7NkLwWbfxgUiQ\n\t DSLDVHciIKjY8tf5aoV7ulbRMx/PXfp28c3VcA5HN5hLhlzdKJFZ/UtmBWr/Nei9EX\n\t Mj+NDUCOtfXeg==","From":"sashiko-bot@kernel.org","Subject":"Re: [PATCH v15 3/7] PCI: Fail FLR when config space is inaccessible","Reply-To":"sashiko@lists.linux.dev","To":"\"Farhan Ali\" <alifm@linux.ibm.com>","Cc":"linux-pci@vger.kernel.org","In-Reply-To":"<20260505200510.2954-4-alifm@linux.ibm.com>","References":"<20260505200510.2954-4-alifm@linux.ibm.com>","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","Date":"Tue, 05 May 2026 22:20:18 +0000","Message-Id":"<20260505222018.9CAC9C2BCB4@smtp.kernel.org>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>"}}]