diff options
author | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2015-10-06 12:47:17 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-10 12:24:47 -0700 |
commit | 0df771dedf67622b9135709fe4cbfb3222481997 (patch) | |
tree | 85ec2ce5e1b233cd2782fe1077bb66e78ad552f6 /drivers/hwtracing/stm/core.c | |
parent | fab6266e82a8981cccec55af47589665daf69fb6 (diff) | |
download | linux-0df771dedf67622b9135709fe4cbfb3222481997.tar.bz2 |
stm class: Mark src::link __rcu
Source device's link is protected with srcu, mark it as such to have
proper build-time validation of accesses to this field. The update
side that's dereferencing it under an update lock also needs an
accessor to dereference this field to keep sparse happy.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing/stm/core.c')
-rw-r--r-- | drivers/hwtracing/stm/core.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index b79c42c62557..b6445d9e5453 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -781,17 +781,20 @@ fail_detach: static void __stm_source_link_drop(struct stm_source_device *src, struct stm_device *stm) { + struct stm_device *link; + spin_lock(&src->link_lock); - if (WARN_ON_ONCE(src->link != stm)) { + link = srcu_dereference_check(src->link, &stm_source_srcu, 1); + if (WARN_ON_ONCE(link != stm)) { spin_unlock(&src->link_lock); return; } - stm_output_free(src->link, &src->output); + stm_output_free(link, &src->output); /* caller must hold stm::link_lock */ list_del_init(&src->link_entry); /* matches stm_find_device() from stm_source_link_store() */ - stm_put_device(src->link); + stm_put_device(link); rcu_assign_pointer(src->link, NULL); spin_unlock(&src->link_lock); |