Blame SOURCES/kvm-address_space_map-address_space_to_flatview-needs-RC.patch

c7c90d
From 622dc83554563b3d6c74ee7936dbc08bfa6bfa1a Mon Sep 17 00:00:00 2001
c7c90d
From: Paolo Bonzini <pbonzini@redhat.com>
c7c90d
Date: Thu, 8 Mar 2018 15:58:18 +0100
c7c90d
Subject: [PATCH 05/17] address_space_map: address_space_to_flatview needs RCU
c7c90d
 lock
c7c90d
c7c90d
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
c7c90d
Message-id: <20180308155819.20598-6-pbonzini@redhat.com>
c7c90d
Patchwork-id: 79196
c7c90d
O-Subject: [RHEL7.5 qemu-kvm-rhev PATCH 5/6] address_space_map: address_space_to_flatview needs RCU lock
c7c90d
Bugzilla: 1554930
c7c90d
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
c7c90d
RH-Acked-by: Thomas Huth <thuth@redhat.com>
c7c90d
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
c7c90d
c7c90d
address_space_map is calling address_space_to_flatview but it can
c7c90d
be called outside the RCU lock.  The function itself is calling
c7c90d
rcu_read_lock/rcu_read_unlock, just in the wrong place, so the
c7c90d
fix is easy.
c7c90d
c7c90d
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
c7c90d
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
c7c90d
(cherry pick from commit ad0c60fa572d4050255b698ecdb67294dd4c0125)
c7c90d
c7c90d
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
c7c90d
---
c7c90d
 exec.c | 3 ++-
c7c90d
 1 file changed, 2 insertions(+), 1 deletion(-)
c7c90d
c7c90d
diff --git a/exec.c b/exec.c
c7c90d
index 431b85b..58ad24b 100644
c7c90d
--- a/exec.c
c7c90d
+++ b/exec.c
c7c90d
@@ -3331,7 +3331,7 @@ void *address_space_map(AddressSpace *as,
c7c90d
     hwaddr l, xlat;
c7c90d
     MemoryRegion *mr;
c7c90d
     void *ptr;
c7c90d
-    FlatView *fv = address_space_to_flatview(as);
c7c90d
+    FlatView *fv;
c7c90d
 
c7c90d
     if (len == 0) {
c7c90d
         return NULL;
c7c90d
@@ -3339,6 +3339,7 @@ void *address_space_map(AddressSpace *as,
c7c90d
 
c7c90d
     l = len;
c7c90d
     rcu_read_lock();
c7c90d
+    fv = address_space_to_flatview(as);
c7c90d
     mr = flatview_translate(fv, addr, &xlat, &l, is_write);
c7c90d
 
c7c90d
     if (!memory_access_is_direct(mr, is_write)) {
c7c90d
-- 
c7c90d
1.8.3.1
c7c90d