summaryrefslogtreecommitdiffstats
path: root/drivers/hv/vmbus_drv.c
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2017-03-04 18:13:57 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-16 16:42:00 +0900
commit8200f2085abe7f29a016381f3122000cc7b2a760 (patch)
tree63b48dc913ec3f3726ec3eb79cafc56ecdcb2822 /drivers/hv/vmbus_drv.c
parentc6240cacdb2c3cb56a21fb3ea0c105154ab87a2a (diff)
downloadlinux-stable-8200f2085abe7f29a016381f3122000cc7b2a760.tar.gz
linux-stable-8200f2085abe7f29a016381f3122000cc7b2a760.tar.bz2
linux-stable-8200f2085abe7f29a016381f3122000cc7b2a760.zip
vmbus: use rcu for per-cpu channel list
The per-cpu channel list is now referred to in the interrupt routine. This is mostly safe since the host will not normally generate an interrupt when channel is being deleted but if it did then there would be a use after free problem. To solve, this use RCU protection on ther per-cpu list. Fixes: 631e63a9f346 ("vmbus: change to per channel tasklet") Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv/vmbus_drv.c')
-rw-r--r--drivers/hv/vmbus_drv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index da6b59ba5940..8370b9dc6037 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -939,8 +939,10 @@ static void vmbus_chan_sched(struct hv_per_cpu_context *hv_cpu)
if (relid == 0)
continue;
+ rcu_read_lock();
+
/* Find channel based on relid */
- list_for_each_entry(channel, &hv_cpu->chan_list, percpu_list) {
+ list_for_each_entry_rcu(channel, &hv_cpu->chan_list, percpu_list) {
if (channel->offermsg.child_relid != relid)
continue;
@@ -956,6 +958,8 @@ static void vmbus_chan_sched(struct hv_per_cpu_context *hv_cpu)
tasklet_schedule(&channel->callback_event);
}
}
+
+ rcu_read_unlock();
}
}