aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-03-05 00:23:26 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2018-03-06 14:01:28 +0100
commitad0c60fa572d4050255b698ecdb67294dd4c0125 (patch)
treef2c62ef3e417aa683f441fda7cbc598ea0a1849d /exec.c
parent11e732a5ed46903f997985bed4c3767ca28a7eb6 (diff)
downloadqemu-ad0c60fa572d4050255b698ecdb67294dd4c0125.zip
qemu-ad0c60fa572d4050255b698ecdb67294dd4c0125.tar.gz
qemu-ad0c60fa572d4050255b698ecdb67294dd4c0125.tar.bz2
address_space_map: address_space_to_flatview needs RCU lock
address_space_map is calling address_space_to_flatview but it can be called outside the RCU lock. The function itself is calling rcu_read_lock/rcu_read_unlock, just in the wrong place, so the fix is easy. Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/exec.c b/exec.c
index 62ed49d..bffb959 100644
--- a/exec.c
+++ b/exec.c
@@ -3468,7 +3468,7 @@ void *address_space_map(AddressSpace *as,
hwaddr l, xlat;
MemoryRegion *mr;
void *ptr;
- FlatView *fv = address_space_to_flatview(as);
+ FlatView *fv;
if (len == 0) {
return NULL;
@@ -3476,6 +3476,7 @@ void *address_space_map(AddressSpace *as,
l = len;
rcu_read_lock();
+ fv = address_space_to_flatview(as);
mr = flatview_translate(fv, addr, &xlat, &l, is_write);
if (!memory_access_is_direct(mr, is_write)) {