lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210327175140.682708-1-mdf@kernel.org>
Date:   Sat, 27 Mar 2021 10:51:40 -0700
From:   Moritz Fischer <mdf@...nel.org>
To:     bhelgaas@...gle.com
Cc:     linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
        moritzf@...gle.com, Moritz Fischer <mdf@...nel.org>,
        Brian Foley <bpfoley@...gle.com>,
        Krzysztof Wilczyński <kw@...ux.com>
Subject: [PATCH RESEND v2] PCI/IOV: Clarify error message for unbound devices

Be more verbose to disambiguate the error case when trying to configure
SRIOV with no driver bound vs. a driver that does not implement the
SRIOV callback.

Reported-by: Brian Foley <bpfoley@...gle.com>
Reviewed-by: Krzysztof Wilczyński <kw@...ux.com>
Signed-off-by: Moritz Fischer <mdf@...nel.org>
---
Changes from v1:
- Added Krzysztof's Reviewed-by
---
 drivers/pci/iov.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 4afd4ee4f7f0..f9ecc691daf5 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -304,8 +304,15 @@ static ssize_t sriov_numvfs_store(struct device *dev,
 	if (num_vfs == pdev->sriov->num_VFs)
 		goto exit;
 
+	/* is PF driver loaded */
+	if (!pdev->driver) {
+		pci_info(pdev, "No driver bound to device. Cannot configure SRIOV\n");
+		ret = -ENOENT;
+		goto exit;
+	}
+
 	/* is PF driver loaded w/callback */
-	if (!pdev->driver || !pdev->driver->sriov_configure) {
+	if (!pdev->driver->sriov_configure) {
 		pci_info(pdev, "Driver does not support SRIOV configuration via sysfs\n");
 		ret = -ENOENT;
 		goto exit;
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ