Skip to content

Commit

Permalink
NTB: Handle ntb client device probes without present hardware
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jon Mason authored and Greg Kroah-Hartman committed Jan 20, 2013
1 parent 2910fe2 commit 8222b40
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/ntb/ntb_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8222b40

Please sign in to comment.