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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1516739665-132304-5-git-send-email-vadimp@mellanox.com>
Date:   Tue, 23 Jan 2018 20:34:24 +0000
From:   Vadim Pasternak <vadimp@...lanox.com>
To:     dvhart@...radead.org, andy.shevchenko@...il.com,
        gregkh@...uxfoundation.org
Cc:     linux-kernel@...r.kernel.org, platform-driver-x86@...r.kernel.org,
        jiri@...nulli.us, Vadim Pasternak <vadimp@...lanox.com>
Subject: [patch v10 5/6] platform/mellanox: mlxreg-hotplug: Add check for negative adapter number value

Verify before creation of hotplug device if the associated adapter number
is negative. It could be in case hotplug event is not associated with
hotplug device.

Signed-off-by: Vadim Pasternak <vadimp@...lanox.com>
---
v10->v9:
 Fixes added by Vadim:
 - add this patch to the series;
---
 drivers/platform/mellanox/mlxreg-hotplug.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c
index f841379..b0d7587 100644
--- a/drivers/platform/mellanox/mlxreg-hotplug.c
+++ b/drivers/platform/mellanox/mlxreg-hotplug.c
@@ -96,6 +96,14 @@ struct mlxreg_hotplug_priv_data {
 static int mlxreg_hotplug_device_create(struct device *dev,
 					struct mlxreg_core_data *data)
 {
+	/*
+	 * Return if adapter number is negative. Return if adapter number is
+	 * negative. It could be in case hotplug event is not associated with
+	 * hotplug device.
+	 */
+	if (data->hpdev.nr < 0)
+		return 0;
+
 	data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr);
 	if (!data->hpdev.adapter) {
 		dev_err(dev, "Failed to get adapter for bus %d\n",
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ