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

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