aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing
diff options
context:
space:
mode:
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>2016-02-15 12:12:05 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-20 17:09:14 -0500
commit1810f2c44817c74ca3d05d1e3981e3a2e2ceb6f5 (patch)
tree49c258a9277cfaa54a76e4992ade8fcd4c191b56 /drivers/hwtracing
parent1192918530381b5cfc0e5da51233fa94f783b221 (diff)
stm class: Fix unlocking braino in the error path
If an illegal attempt is made to unlink stm source device from an stm device, the stm device's link spinlock mistakenly remains locked. While this really shouldn't happen (there's a warning in place), the locking should remain in order so that we can still recover from this situation if it indeed does happen. This patch unifies the unlocking in the exit path of __stm_source_link_drop() to fix this. Reported-by: Laurent Fert <laurent.fert@intel.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r--drivers/hwtracing/stm/core.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index 0db303b50e51..4a626d8990b2 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -816,10 +816,8 @@ static void __stm_source_link_drop(struct stm_source_device *src,
816 spin_lock(&stm->link_lock); 816 spin_lock(&stm->link_lock);
817 spin_lock(&src->link_lock); 817 spin_lock(&src->link_lock);
818 link = srcu_dereference_check(src->link, &stm_source_srcu, 1); 818 link = srcu_dereference_check(src->link, &stm_source_srcu, 1);
819 if (WARN_ON_ONCE(link != stm)) { 819 if (WARN_ON_ONCE(link != stm))
820 spin_unlock(&src->link_lock); 820 goto unlock;
821 return;
822 }
823 821
824 stm_output_free(link, &src->output); 822 stm_output_free(link, &src->output);
825 list_del_init(&src->link_entry); 823 list_del_init(&src->link_entry);
@@ -827,6 +825,7 @@ static void __stm_source_link_drop(struct stm_source_device *src,
827 stm_put_device(link); 825 stm_put_device(link);
828 rcu_assign_pointer(src->link, NULL); 826 rcu_assign_pointer(src->link, NULL);
829 827
828unlock:
830 spin_unlock(&src->link_lock); 829 spin_unlock(&src->link_lock);
831 spin_unlock(&stm->link_lock); 830 spin_unlock(&stm->link_lock);
832} 831}