stm class: Fix a race in unlinking
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>
Mon, 15 Feb 2016 17:12:08 +0000 (19:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Feb 2016 22:09:14 +0000 (14:09 -0800)
commitb4ca34aaf78ed0cdfc15956d377064104257a437
tree69100826c2b2d596afa8e4792a430bec32761ad1
parentf7c81c7176c72c7899390754b4b038a64b296e4d
stm class: Fix a race in unlinking

There is a window in stm_source_link_drop(), during which the source's
link may change before locks are acquired. When this happens, it throws
a warning, since this is not an expected scenario.

This patch handles the race in such a way that if the link appears to
have changed by the time we took the locks, it will release them and
repeat the whole unlinking procedure from the beginning, unless the
other contender beat us to it.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/stm/core.c