greybus: operation: fix operation-destroy race
authorJohan Hovold <johan@hovoldconsulting.com>
Thu, 9 Jul 2015 13:17:58 +0000 (15:17 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 13 Jul 2015 22:29:27 +0000 (15:29 -0700)
commit85109f7ddde4b1842bfb08741a8b461e31ef2c4f
tree4bd94039cb5d36bd53f8299b5fb4634474d734d7
parent5c1ac6945526c76258869c8c04632ab5ae61bdab
greybus: operation: fix operation-destroy race

Make sure to acquire the connection-list lock atomically when releasing
the final reference.

This allows the list to be traversed and references to be acquired
(while holding the lock) without racing with the destructor.

Suggested-by: Greg Kroah-Hartman <gregkh@google.com>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/operation.c