[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1358586155-23322-3-git-send-email-jon.mason@intel.com>
Date: Sat, 19 Jan 2013 02:02:16 -0700
From: Jon Mason <jon.mason@...el.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Dave Jiang <dave.jiang@...el.com>,
Nicholas Bellinger <nab@...ux-iscsi.org>
Subject: [PATCH 02/21] NTB: Handle ntb client device probes without present hardware
Attempts to probe client ntb drivers without ntb hardware present will
result in null pointer dereference due to the lack of the ntb bus device
being registers. Check to see if this is the case, and fail all calls
by the clients registering their drivers.
Signed-off-by: Jon Mason <jon.mason@...el.com>
---
drivers/ntb/ntb_transport.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 250190f..1d17857 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -288,6 +288,9 @@ int ntb_register_client_dev(char *device_name)
struct ntb_transport *nt;
int rc;
+ if (list_empty(&ntb_transport_list))
+ return -ENODEV;
+
list_for_each_entry(nt, &ntb_transport_list, entry) {
struct device *dev;
@@ -336,6 +339,9 @@ int ntb_register_client(struct ntb_client *drv)
{
drv->driver.bus = &ntb_bus_type;
+ if (list_empty(&ntb_transport_list))
+ return -ENODEV;
+
return driver_register(&drv->driver);
}
EXPORT_SYMBOL_GPL(ntb_register_client);
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists