]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
greybus: timesync: Do not hold mutex on cancel_delayed_work_sync
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Thu, 16 Jun 2016 12:42:14 +0000 (13:42 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 16 Jun 2016 16:07:41 +0000 (09:07 -0700)
commitc9e8f893eeef4f0e2d10333aed2d175e50a56dab
tree16b39f62e3df322bccd91dbc349bd579a66c44cf
parentdf124299d1d3e64175c79f83b4ecf2710d202e49
greybus: timesync: Do not hold mutex on cancel_delayed_work_sync

There is a scenario where gb_timesync_svc_remove() can run, attain a mutex
and call cancel_delayed_work_sync(). In the meantime a worker may already
be running and trying to attain the same mutex but will never do so as the
gb_timesync_svc_remove() path is holding the mutex and waiting on the
delayed_work_sync() to complete - leading to deadlock. This patch addresses
by calling the cancel_delayed_work_sync() before locking the relevant
mutex.

Reported-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Tested-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/timesync.c