From 622dc83554563b3d6c74ee7936dbc08bfa6bfa1a Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 8 Mar 2018 15:58:18 +0100 Subject: [PATCH 05/17] address_space_map: address_space_to_flatview needs RCU lock RH-Author: Paolo Bonzini Message-id: <20180308155819.20598-6-pbonzini@redhat.com> Patchwork-id: 79196 O-Subject: [RHEL7.5 qemu-kvm-rhev PATCH 5/6] address_space_map: address_space_to_flatview needs RCU lock Bugzilla: 1554930 RH-Acked-by: Cornelia Huck RH-Acked-by: Thomas Huth RH-Acked-by: Laurent Vivier 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 Signed-off-by: Paolo Bonzini (cherry pick from commit ad0c60fa572d4050255b698ecdb67294dd4c0125) Signed-off-by: Miroslav Rezanina --- exec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 431b85b..58ad24b 100644 --- a/exec.c +++ b/exec.c @@ -3331,7 +3331,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; @@ -3339,6 +3339,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)) { -- 1.8.3.1