Blame SOURCES/kvm-address_space_rw-address_space_to_flatview-needs-RCU.patch

c7c90d
From ca87b042011f83f8851f0f76b3599d627d61463d Mon Sep 17 00:00:00 2001
c7c90d
From: Paolo Bonzini <pbonzini@redhat.com>
c7c90d
Date: Thu, 8 Mar 2018 15:58:19 +0100
c7c90d
Subject: [PATCH 06/17] address_space_rw: address_space_to_flatview needs RCU
c7c90d
 lock
c7c90d
c7c90d
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
c7c90d
Message-id: <20180308155819.20598-7-pbonzini@redhat.com>
c7c90d
Patchwork-id: 79192
c7c90d
O-Subject: [RHEL7.5 qemu-kvm-rhev PATCH 6/6] address_space_rw: 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_rw is calling address_space_to_flatview but it can
c7c90d
be called outside the RCU lock.  To fix it, transform flatview_rw
c7c90d
into address_space_rw, since flatview_rw is otherwise unused.
c7c90d
c7c90d
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
c7c90d
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
c7c90d
(cherry pick from commit db84fd973eba3f1e121416dcab73a4e8a60f2526)
c7c90d
c7c90d
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
c7c90d
---
c7c90d
 exec.c | 28 ++++++++++------------------
c7c90d
 1 file changed, 10 insertions(+), 18 deletions(-)
c7c90d
c7c90d
diff --git a/exec.c b/exec.c
c7c90d
index 58ad24b..12ec761 100644
c7c90d
--- a/exec.c
c7c90d
+++ b/exec.c
c7c90d
@@ -3045,24 +3045,6 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
c7c90d
                                   addr1, l, mr);
c7c90d
 }
c7c90d
 
c7c90d
-static MemTxResult flatview_rw(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
c7c90d
-                               uint8_t *buf, int len, bool is_write)
c7c90d
-{
c7c90d
-    if (is_write) {
c7c90d
-        return flatview_write(fv, addr, attrs, (uint8_t *)buf, len);
c7c90d
-    } else {
c7c90d
-        return flatview_read(fv, addr, attrs, (uint8_t *)buf, len);
c7c90d
-    }
c7c90d
-}
c7c90d
-
c7c90d
-MemTxResult address_space_rw(AddressSpace *as, hwaddr addr,
c7c90d
-                             MemTxAttrs attrs, uint8_t *buf,
c7c90d
-                             int len, bool is_write)
c7c90d
-{
c7c90d
-    return flatview_rw(address_space_to_flatview(as),
c7c90d
-                       addr, attrs, buf, len, is_write);
c7c90d
-}
c7c90d
-
c7c90d
 MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
c7c90d
                                     MemTxAttrs attrs, uint8_t *buf, int len)
c7c90d
 {
c7c90d
@@ -3096,6 +3078,16 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
c7c90d
     return result;
c7c90d
 }
c7c90d
 
c7c90d
+MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
c7c90d
+                             uint8_t *buf, int len, bool is_write)
c7c90d
+{
c7c90d
+    if (is_write) {
c7c90d
+        return address_space_write(as, addr, attrs, buf, len);
c7c90d
+    } else {
c7c90d
+        return address_space_read_full(as, addr, attrs, buf, len);
c7c90d
+    }
c7c90d
+}
c7c90d
+
c7c90d
 void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
c7c90d
                             int len, int is_write)
c7c90d
 {
c7c90d
-- 
c7c90d
1.8.3.1
c7c90d