summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/connection.c
diff options
context:
space:
mode:
authorJohan Hovold2015-11-25 15:59:12 +0100
committerGreg Kroah-Hartman2015-11-26 00:34:19 +0100
commit0daf17b9e4f74981c7546ad4b4224b8bef85e00e (patch)
tree724e98b7033e3724eecc854cc84d11be8cb416a8 /drivers/staging/greybus/connection.c
parentgreybus: connection: clean up connection-creation interface (diff)
downloadkernel-qcow2-linux-0daf17b9e4f74981c7546ad4b4224b8bef85e00e.tar.gz
kernel-qcow2-linux-0daf17b9e4f74981c7546ad4b4224b8bef85e00e.tar.xz
kernel-qcow2-linux-0daf17b9e4f74981c7546ad4b4224b8bef85e00e.zip
greybus: connection: fix potential null-deref on create
Make sure that the interface lookup helper can handle static, bundle-less connections without oopsing when creating further connections. Note that the initial svc-connection has always been bundle-less, but did not trigger an oops as a bundle was created for it before further connections were created. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/connection.c')
-rw-r--r--drivers/staging/greybus/connection.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c
index d87a346d1ce3..a7b803799fa5 100644
--- a/drivers/staging/greybus/connection.c
+++ b/drivers/staging/greybus/connection.c
@@ -20,10 +20,12 @@ gb_connection_intf_find(struct gb_interface *intf, u16 cport_id)
struct gb_host_device *hd = intf->hd;
struct gb_connection *connection;
- list_for_each_entry(connection, &hd->connections, hd_links)
- if (connection->bundle->intf == intf &&
+ list_for_each_entry(connection, &hd->connections, hd_links) {
+ if (connection->intf == intf &&
connection->intf_cport_id == cport_id)
return connection;
+ }
+
return NULL;
}