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

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