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)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Wed, 1 Jun 2016 21:28:48 +0000 (15:28 -0600)
commitfffb71e99d58c8d8a1481821a9d39d90b004dc38
tree2d7be4ef35eda4037c2e4464d0925401e37241ca
parent984a45ed12b5c04728f85e9c258ba1ae9ebac2d3
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>
(cherry picked from commit b4ca34aaf78ed0cdfc15956d377064104257a437)
drivers/hwtracing/stm/core.c