]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
greybus: connection: bind protocol after the connection is operational
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 1 Jul 2015 06:43:54 +0000 (12:13 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 1 Jul 2015 23:34:55 +0000 (16:34 -0700)
commitb758d68618ffda2f6c1c1d40f90350429e9f7092
treee91c360274acaeb0fadf9c621fabde1dd793fe4f
parent463e8736a3a5038732f681a7f1e9f6975d25b3fd
greybus: connection: bind protocol after the connection is operational

We may bind protocol with a connection from gb_connection_create(), if
bundle's device_id is already set. That's not the case until now.

But if the protocol is initialized with a call to
protocol->connection_init() from this place, kernel will crash.

This will happen because the connection isn't fully initialized yet, for
example its operation list isn't initialized yet. And as soon as the
protocol driver tries to send a request to the module from its
connection_init() callback, we will add an operation to this
uninitialized list. And it will crash while doing:

        prev->next = new;

Try to bind the connection with a protocol only after the connection is
ready for operations.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/connection.c