greybus: connection: fix lookup race
authorJohan Hovold <johan@hovoldconsulting.com>
Tue, 19 Jan 2016 11:51:25 +0000 (12:51 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 19 Jan 2016 20:17:13 +0000 (12:17 -0800)
commit0e46fab7dd5afbb4db97d9520812c57e9301bfc2
treed165efb0b613ace84f2ad6e3c36a0ee6ab445717
parentc6d64a19cdb39680460ab9f153e33843aa8c825c
greybus: connection: fix lookup race

Fix longstanding race that could lead to a connection being destroyed
while processing an incoming message due to missing reference counting
when looking up the connection.

Add helpers to manipulate the connection kref.

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