greybus: timesync: Enforce TimeSync locks as subordinate to Interface locks
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Thu, 23 Jun 2016 15:26:00 +0000 (16:26 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 23 Jun 2016 21:15:21 +0000 (14:15 -0700)
commit1211915127c152a86e68ea35770c9e2524020d4f
tree792c2797e1a18c28e7ca2598dfba2acc2ea28662
parent5e2b63915cb6f1e86f9515342cfcfb28cd82c5b0
greybus: timesync: Enforce TimeSync locks as subordinate to Interface locks

gb_timesync_svc_teardown() is called from gb_timesync_svc_del() and issues a
command to a remote Interface to switch off its timers. The lock ordering
is TimeSync => Interface in this case. However gb_module_del() takes an
Interface lock then calls gb_interface_del() => gb_timesync_svc_del() in
this case the lock ordering is Interface => TimeSync.

This patch fixes by removing the taking of the Interface mutex in
gb_interface_timesync_do_something(). If an Interface is present in the
TimeSync linked-list - it is by definition intf->enabled.

Reported-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/interface.c