summaryrefslogtreecommitdiffstats
path: root/drivers/ntb
diff options
context:
space:
mode:
authorJon Mason <jon.mason@intel.com>2013-01-19 02:02:16 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-20 15:45:50 -0800
commit8222b402e2df3b92948141046bae82fb774f3f64 (patch)
treee4102fb924c2fd047dcddc04dd502486b77d9955 /drivers/ntb
parent2910fe2a7d0dc0d01944110e462045441ba0856f (diff)
downloadlinux-8222b402e2df3b92948141046bae82fb774f3f64.tar.bz2
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@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/ntb')
-rw-r--r--drivers/ntb/ntb_transport.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 250190fba757..1d17857a2d97 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);